qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: Strange situation with qpid::sys::Thread and fds
Date Wed, 09 May 2012 12:33:58 GMT
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.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message