From owner-freebsd-threads@FreeBSD.ORG Fri Mar 31 20:40:27 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A72416A422 for ; Fri, 31 Mar 2006 20:40:27 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id A91FC43D49 for ; Fri, 31 Mar 2006 20:40:24 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.6/8.13.6/NETPLEX) with ESMTP id k2VKeN55017172; Fri, 31 Mar 2006 15:40:23 -0500 (EST) Date: Fri, 31 Mar 2006 15:40:23 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Niall Douglas In-Reply-To: <442D9E8C.7186.4BAD0@s_sourceforge.nedprod.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: freebsd-threads@freebsd.org Subject: Re: recvfrom() not a thread cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Mar 2006 20:40:27 -0000 On Fri, 31 Mar 2006, Niall Douglas wrote: > Hi, > > 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. 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). > Is there an alternative method of receiving UDP packets which is > thread cancellable? The best I can see is using plain read() but this > of course won't return the sender of the UDP packet. -- DE