Subject: select call implementation and threads
To: None <tech-kern@netbsd.org>
From: malleswararao venkatanaga <bobbyavn@yahoo.com>
List: tech-kern
Date: 05/23/2003 09:50:02
Hi,
 I'm facing a problem and it is somewhat like this,
  1)I spawn a thread using pthread_create()
  2) In the thread I open a socket, bind it to a port
say 10001 and block it in the select call for
receiving a UDP message.
  Similarly 
  In my main thread i open a socket and bind it to a 
port say 10000 and block the main thread in a select
call.
  Both the main thread and the other thread are
essentially waiting for different messages on
different ports and different socket fds with their
respective select calls.
  I observe that if i send a messages to both of them
only one of them receives while the other one is still
blocked in the select call though it has messages to
read. 

  Can someone explain me why is this. I might sound
vague or missing some concept here. But I've tried
various scenarios but in each of them there are no
deterministic results most of the cases only one of
the thread breaks from the select the other one
doesnot. 
 I'm using pthreads library which is available in a
package for the netbsd 1.6 
thanks

  


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com