From owner-freebsd-threads@FreeBSD.ORG Fri Aug 20 01:14:56 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2328910656A7 for ; Fri, 20 Aug 2010 01:14:56 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0DAED8FC16; Fri, 20 Aug 2010 01:14:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7K1Esxo051443; Fri, 20 Aug 2010 01:14:55 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C6DD70F.5070803@freebsd.org> Date: Fri, 20 Aug 2010 01:14:55 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Kostik Belousov References: <4C6926D0.2020909@freebsd.org> <20100816082022.GO2396@deviant.kiev.zoral.com.ua> <4C696A96.7020709@freebsd.org> <20100816104303.GP2396@deviant.kiev.zoral.com.ua> <4C6AA092.40708@freebsd.org> <4C6BE0F7.10207@freebsd.org> <20100818100403.GS2396@deviant.kiev.zoral.com.ua> <4C6C6184.9030602@freebsd.org> <20100819083809.GC2396@deviant.kiev.zoral.com.ua> <4C6D6384.7080506@freebsd.org> <20100819144218.GH2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100819144218.GH2396@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: PTHREAD_CANCEL_DEFERRED X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2010 01:14:56 -0000 Kostik Belousov wrote: > > What would happen in the following situation: > thr_wake() is called; > some syscall is started executing and slept, assume that SA_RESTART is > for SIGHUP (just an example); > SIGHUP is sent to the process and the thread is selected > for delivery, also assume that handler is installed. > > As I understand, in this situation, EINTR is returned from syscall. Yes, because cancellation should have higher priority over signals, if signal always causes ERESTART to be returned, and system call is always restarted, the system call may not return forever because its event it is waiting never happens, for example, it is reading a byte from a socket, but it is never available, we end up not being able to cancel the thread, this is incorrect.