Sean Boudreau(deleted)
|
Re: ionotify & _NOTIFY_COND_OUTPUT
|
Sean Boudreau(deleted)
10/17/2007 9:12 AM
post2058
|
Re: ionotify & _NOTIFY_COND_OUTPUT
On Tue, Oct 16, 2007 at 02:34:15PM -0400, Martin Sevcik wrote:
> Hello,
> I'm trying to set a _NOTIFY_COND_OUTPUT notification on file descriptor
> but it never gets armed. _NOTIFY_COND_INPUT works fine and so does the
> select() function with this fd in write set. So maybe the source code of
> select() function would be helpful. I only found source code of
> _select_event(). I attached a snippet of code. Am I missing something?
>
> fd = open( "/file_path", O_RDWR )
> chid = ChannelCreate(0);
> coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0);
> SIGEV_PULSE_INIT( &event, coid, 0, SI_NOTIFY, value );
> ionotify( fd, _NOTIFY_ACTION_POLLARM, _NOTIFY_COND_OUTPUT, &event );
> for(;;) {
> MsgReceive( chid, ...);
> }
With _NOTIFY_ACTION_POLLARM you have to check the
return from ionotify() to see if the condition
was satisfied at the time of the call (the POLL
part of POLLARM)
if (ionotify(, _NOTIFY_ACTION_POLLARM, _NOTIFY_COND_OUTPUT,) &
_NOTIFY_COND_OUTPUT) {
/* handle it */
}
-seanb
|
|
|