Go to the FreeLists Home Page Home Signup Help Login
 



[openbeosnetteam] || [Date Prev] [08-2002 Date Index] [Date Next] || [Thread Prev] [08-2002 Thread Index] [Thread Next]

[openbeosnetteam] Yet another select() support fix. again.

  • From: Philippe Houdoin <philippe.houdoin@xxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Fri, 09 Aug 2002 18:53:38 +0200 (MEST)
Axel wrote:
> True. Anyway, I don't understand how you'll want to use the release 
> count to report anything back, bug using a semaphore for select() 
> seems to be the right way (the other would be a port).


In on_socket_event callback(selectsync * sync, uint32 ref):
sem_id select_wakeup_sem = (sem_id) sync;
release_sem_etc(select_wakeup_sem, ref);

In select(), after a successfull acquire_sem(select_wakeup_sem), I get the sem 
sem count => -ref, then delete it.

The "ref" is a magic number:
fd of the socket selected() << 8 | select event to monitor (read = 1, write = 
2, exception = 3). I pass it to net_stack_[de]select() via ioctl().
In fact, BONE select() send a similar build 'ref' value ;-)

That way, by looking at sem count, I could know which fd and on what event 
wakeup select(). Without needing to pass any fd_set data to kernel land!

Downside: One and only one fd/event will be return by select().
But if it works, it's way better than net_server select() support...

-Philippe.





[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.