On Wed, May 09, 2012 at 08:33:58AM -0400, Alan Conway wrote:
> On 05/08/2012 10:03 AM, Darryl L. Pierce wrote:
> >On Tue, May 08, 2012 at 08:52:32AM -0500, Steve Huston wrote:
> >>What kind of fd is this? Linux?
> >
> >Yes. There's a class named Prong that creates a one-way pipe for sending
> >a notification to the Ruby thread to wake it up. The pipe is created
> >using the pipe() API, then fcntl() to make the descriptor non-blocking.
> >
> >>The symptom sounds like what would happen if a TCP socket write were done
> >>and TCP buffered the byte. Setting no-delay on the socket would resolve
> >>that.
> >
> >I tried adding O_NDELAY to the flags for the fds and it made no
> >difference:
> >
> >flags = ::fcntl(yourHandle, F_GETFL);
> >if((::fcntl(yourHandle, F_SETFL, flags | O_NONBLOCK | O_NDELAY))== -1)
> > throw MessagingException("Unable to make your handle non-blocking.");
> >
>
> Sounds like you are doing something very similar to
> qpid::sys::PollableQueue or qpid::sys::Condition. You might be able
> to cut/paste some of the code.
>
> PollableCondition exposes an FD to be added to qpid::sys::Poller.
> The FD is readable iff the condition is set.
> PollableQueue is a work queue that uses a PollableCondition so that
> it is pollable iff there is data in the queue.Looking through the code it looks like the ideal for what I'm going for. I would like the CommandRunner (renamed the class) to not sleep but to respond immediately to a new command being enqueued. I'll pull what I can out of this code and see if that helps. -- 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/
pgplvL1KbTeFA.pgp
Description: PGP signature
