[ace-users] howto return immediately from poll ?

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Thu Jun 14 00:47:45 CDT 2007


>Version: 5.5.8
>host: windows xp sp2, suse linux enterprise server 9 sp2
>compiler: vs.net 2003, gcc 3.3.3
>in my app, I call poll to wait on a file descriptor (in fact, it is an
>inotify handler). to achieve, I wait infinitely.  My question is :
>How to notify the poll function to return ?  I close the file
>descriptor from another thread, but it still
>blocks. Can I poll on an event handler, so when needed, I can signal
>the event (so the poll function returns).

The only portable way to do this is to use a "notify pipe" and then
use ACE_OS::select() to wait on the notify pipe's handle *and* your
I/O descriptor.  This is basically what the ACE_Select_Reactor does.
Note that this only works portably if your descriptor is actually a

Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu

More information about the Ace-users mailing list