I've been working on a fix for the blocking APIs. I found another way of
approaching the issue than to make the blocking calls non-blocking.

My first attempt is to create a new native extension to Ruby named
Qpid::Messaging::SessionDispatcher. An instance is automatically created
by Qpid::Messaging::Session as a field.

What the dispatcher does is start a background process that uses Ruby's
rb_thread_blocking_region api to unlock the process and allow the Ruby
VM to continue. Then it calls Session.next_receiver and waits.

When a receiver is returned it calls a method for now on Session to
handle getting the message and dispatching it. Though I like the idea of
instead having individual receivers have a lamdba function registered
with them so they can individual respond to their own messages however
the programming seems fit.

You can check out the code here [1].

[1] 
http://github.com/mcpierce/Qpid/tree/QPID-4573-provide-nonblocking-io-in-ruby
-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/

Attachment: pgp7OXjMkOnKZ.pgp
Description: PGP signature

Reply via email to