Subject:
[ruby-ffi] Ruby callbacks from C code from a separate thread, hangs.
From:
Avishek Sen Gupta
Date:
12/30/12 1:52 AM
To:
ruby-ffi@googlegroups.com

Hello!
I'm currently working on some code where I'm utilising FFI::Function objects referenced by function pointers in a C struct. The C code expects the callbacks to be synchronous; however, a few times, the call is made from a separate thread.
This leads FFI to grab a mutex and wait for the callback's done property to be set to true. However, my callbacks return values in a synchronous fashion. Thus, the FFI call hangs as it keeps spinning waiting for the (supposedly) asynchronous callback to complete.
What would you suggest I do to signal the end of the callback in the Ruby code?

Thanks!