atom feed4 messages in org.freebsd.freebsd-threadsrecvfrom() not a thread cancellation ...
FromSent OnAttachments
Niall DouglasMar 31, 2006 8:26 pm 
Daniel EischenMar 31, 2006 8:40 pm 
Niall DouglasMar 31, 2006 8:56 pm 
Daniel EischenMar 31, 2006 9:00 pm 
Subject:recvfrom() not a thread cancellation point
From:Niall Douglas (s_so@nedprod.com)
Date:Mar 31, 2006 8:56:28 pm
List:org.freebsd.freebsd-threads

On 31 Mar 2006 at 15:40, Daniel Eischen wrote:

How do I receive UDP packets using recvfrom() when it would seem that recvfrom() is not a thread cancellation point on FreeBSD 6.0?

1) select() or poll() instead, then recvfrom(). UDP packets are never partial IIRC.

Ah, that's a good idea.

2) Unmask a signal in the thread doing the recvfrom(), then use pthread_kill() to interrupt it (don't use SA_RESTART for sa_flags in the signal action).

Not practical unfortunately as who knows how many threads are concurrently doing recvfrom()'s.

Thanks for the hint. I hadn't thought of using poll.

Cheers, Niall