> If you have the freedom to re-architect your application, look at the > EventMachine library. It was designed to enable applications like yours to > be implemented without threads. Actually, the EventMachine library looks like a fantastic solution! Do you think it would be wise to implement a Ruby to C RPC mechanism on top of it? Thus instead of using native calls I would invoke an RPC stub from Ruby that will deliver a UDP packet with the native function name and parameters to a PThread that will in turn call the C function. Any result from C would be passed back to Ruby using the same channel, allowing the Ruby code to synchronize using traditional methods and avoid an utter threading mess.