I'm interfacing with a C library that provides the ability to set a callback
function so you can be notified when some job is done. I'm hoping to exploit
this with the Task interface so I can feed multiple jobs with a single Julia
process. I'm declaring my notify function like this:
function callback_notify(hnd, status, data)
println("In notify")
s = unsafe_pointer_to_objref(data)::Stream
@show s
s.status = status
notify(s.c)
println("Done notifying")
nothing
end
Stream is a type that has a Condition member,
type Stream
handle::StreamHandle
status::Cuint
c::Condition
end
I've successfully set the callback function, issued wait(s.c), and from the
println statements I can see that the notify callback executes fully. However,
my task never wakes up. My suspicion is that the C library is spawning a new
thread; does that pose problems for the Task interface? Or is something else
happening? Any good workarounds?
--Tim