Skip to content

Commit c8e9a60

Browse files
committed
Change version check to threading check to disable subscriptions
1 parent 486a370 commit c8e9a60

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

src/RobotOS.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ function __init__()
2323
end
2424
end
2525

26+
_threads_enabled() = ccall(:jl_threading_enabled, Cint, ()) != 0
27+
2628
include("debug.jl")
2729
include("time.jl")
2830
include("gentypes.jl")

src/pubsub.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function publish{MsgType<:MsgT}(p::Publisher{MsgType}, msg::MsgType)
1717
pycall(p.o["publish"], PyAny, convert(PyObject, msg))
1818
end
1919

20-
if VERSION >= v"0.5.0-dev+3692" #callbacks are broken
20+
if _threads_enabled() #callbacks are broken
2121

2222
type Subscriber{T}
2323
end
@@ -50,4 +50,4 @@ Subscriber{MsgType<:MsgT}(
5050
kwargs...
5151
) = Subscriber{MsgType}(ascii(topic), cb, cb_args; kwargs...)
5252

53-
end #version check
53+
end #check

src/services.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232
resp
3333
end
3434

35-
if VERSION >= v"0.5.0-dev+3692" #callbacks are broken
35+
if _threads_enabled() #callbacks are broken
3636

3737
type Service{T}
3838
end
@@ -75,7 +75,7 @@ function Service{SrvType<:ServiceDefinition}(
7575
Service{SrvType}(ascii(name), handler; kwargs...)
7676
end
7777

78-
end #version check
78+
end #check
7979

8080
function wait_for_service(service::AbstractString; kwargs...)
8181
try

test/pubsub.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function pose_cb(msg::PoseStamped, msgs::Vector{PoseStamped})
3636
end
3737
pose_cb(PoseStamped(), msgs) #warm up run
3838

39-
if VERSION >= v"0.5.0-dev+3692" #callbacks are broken
39+
if RobotOS._threads_enabled() #callbacks are broken
4040

4141
warn("Not testing subscriber!")
4242

@@ -66,4 +66,4 @@ for i=1:Nmsgs
6666
end
6767
empty!(msgs)
6868

69-
end #version check
69+
end #check

test/services.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function srv_cb(req::GetPlanRequest)
2424
return resp
2525
end
2626

27-
if VERSION >= v"0.5.0-dev+3692" #callbacks are broken
27+
if RobotOS._threads_enabled() #callbacks are broken
2828

2929
warn("Not testing service provider!")
3030

@@ -64,7 +64,7 @@ if flag[1]
6464
end
6565
empty!(msgs)
6666

67-
end #version check
67+
end #check
6868

6969
#Test error handling
7070
@test_throws ErrorException wait_for_service("fake_srv", timeout=1.0)

test/typegeneration.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ emptymsg = std_msgs.msg.Empty()
7777
@test isdefined(std_msgs.msg, :Float64Msg)
7878
@test isdefined(std_msgs.msg, :StringMsg)
7979
@test Publisher{std_msgs.msg.Float64Msg}("x", queue_size=10) != nothing
80-
VERSION < v"0.5.0-dev+3692" &&
80+
if ! RobotOS._threads_enabled()
8181
@test Subscriber{std_msgs.msg.Float64Msg}("x", x->x, queue_size=10) != nothing
82+
end

0 commit comments

Comments
 (0)