[openbeosnetteam] Re: It build again !

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Wed, 30 Oct 2002 18:00:35 +0100 CET

Philippe Houdoin <philippe.houdoin@xxxxxxx> wrote:
> Can you explain what's your new select even notification api is?

It's simple:
status_t notify_select_event(selectsync *sync, uint32 ref, uint8 

Instead of:
void notify_select_event(selectsync *sync, uint32 ref);

In BeOS, the ref field was encoded to contain a) the file descriptor, 
b) the array position in a private structure, and c) the select event -
 or something very similar :-)

In OpenBeOS, the ref field only contain the array position for the file 
descriptor in the internal structure selectsync. With a separate event 
field, the implementation for select events is much easier for drivers; 
with the Be way, the driver had to save individual selectsync/ref for 
each selected event - with the new API you only have to store one 
selectsync/ref pair per listener and are allowed to send out 
notification for everything - only the selected events will trigger an 
notification for the waiting select/poll calls.

It will still call the driver's select function in the same way as 
before, but selectsync/ref are guaranteed to be a stable pair (but 
there could be more than one if the driver wants to support this, e.g. 
different threads selecting on the same socket).

So in the driver you can fire up all notifications once you have that 
pair, you don't have to extra check only for the ones selected before 
(although will still work).

That's not only simpler, but also needed because poll() should set 
POLLERR and POLLHUP even if those events aren't selected.


Other related posts: