You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by C K Tan <ck...@nxscientific.com> on 2005/03/24 17:45:31 UTC

QUESTION: apr_poll / pipe / win32

Hi, In APR 1.1.0, I am using the apr_poll function to wait (blocking) 
on a bunch of sockets in thread A. At some point, thread B needs to 
make thread A exit the apr_poll function even though none of the 
sockets in the pollset is signaled. What's the best way to do it?

I tried adding a pipe to the pollset in A, and have B send a byte to 
make it readable. This works well on unix, but does not work in 
windows. It seems that waiting on pipe is not implemented for windows.

Any suggestions?


Thanks,
-cktan


Re: QUESTION: apr_poll / pipe / win32

Posted by Ryan Bloom <rb...@gmail.com>.
I am pretty sure that the only thing you can do portably, is to create
a new socket and add that to the pollset.  The socket can be localhost
only, which would mean that it won't be security concern. The problem
is that many platforms don't support polling on non-sockets.

I wish I had a better answer, but I can't think of one off hand.

Ryan

On Fri, 25 Mar 2005 00:45:31 +0800, C K Tan <ck...@nxscientific.com> wrote:
> Hi, In APR 1.1.0, I am using the apr_poll function to wait (blocking)
> on a bunch of sockets in thread A. At some point, thread B needs to
> make thread A exit the apr_poll function even though none of the
> sockets in the pollset is signaled. What's the best way to do it?
> 
> I tried adding a pipe to the pollset in A, and have B send a byte to
> make it readable. This works well on unix, but does not work in
> windows. It seems that waiting on pipe is not implemented for windows.
> 
> Any suggestions?
> 
> Thanks,
> -cktan
> 
> 


-- 
Ryan Bloom
rbb@apache.org
rbb@rkbloom.net
rbloom@gmail.com

Re: QUESTION: apr_poll / pipe / win32

Posted by Nathanael Noblet <na...@gnat.ca>.
On Mar 24, 2005, at 8:45 AM, C K Tan wrote:

> Hi, In APR 1.1.0, I am using the apr_poll function to wait (blocking) 
> on a bunch of sockets in thread A. At some point, thread B needs to 
> make thread A exit the apr_poll function even though none of the 
> sockets in the pollset is signaled. What's the best way to do it?

Though not my expertise at all, it seems that if A is waiting for info 
on a number of sockets, why not have B open a socket, after the 
designated amount of time write to the socket, A tests and realizes it 
is the information from B and nothing arrived? Or is there not a 
timeout function on the poll?

-- 
Nathanael D. Noblet
Gnat Solutions
204 - 131 Gorge Road E
Victoria, BC V9A 1L1

T 250.385.4613
C 250.893.4613
http://www.gnat.ca/