Hi,
        I recently found this while using the library on FreeBSD 2.2.8
though it seems to be a general code issue so it should be applicable
anywhere.  When two or more threads are using the same UDP socket you can
get to a condition where the entire process is blocked in recvfrom()

The entry condition is where one thread is blocked on, say, select()
while the other is waiting in line #30 of pth_recvfrom_ev()

when a packet comes in on the shared port, both threads get moved to the
running queue, and the one on select goes first.  The first thread will
fully consume the packet, then block again on select.

The second thread then returns from its pth_event but then never goes back
and checks the socket with pth_sc(select) again (timeout val of 0)

so it will move onto the real recvfrom().

A simple while loop around the code here will solve the problem (going
back into the event wait if the select fails again after just coming back
from it)

Thanks!

Sincerely,

Neal Tibrewala
Doctoral Candidate
Dept. Electrical & Computer Engineering
Carnegie Mellon University
______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to