Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2006 16:00:46 -0500 (EST)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Niall Douglas <s_sourceforge@nedprod.com>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: recvfrom() not a thread cancellation point
Message-ID:  <Pine.GSO.4.43.0603311559430.7507-100000@sea.ntplx.net>
In-Reply-To: <442DA512.7000.1E3815@s_sourceforge.nedprod.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 31 Mar 2006, Niall Douglas wrote:

> 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.

If you know how to cancel a particular thread, then you know
how to send a signal to a particular thread (pthread_kill(tid, sig)).

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

-- 
DE




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0603311559430.7507-100000>