From owner-freebsd-current@FreeBSD.ORG Tue Aug 2 14:28:59 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2466616A41F for ; Tue, 2 Aug 2005 14:28:59 +0000 (GMT) (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 7B14443D4C for ; Tue, 2 Aug 2005 14:28:56 +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.4/8.13.4/NETPLEX) with ESMTP id j72EStvv016954; Tue, 2 Aug 2005 10:28:55 -0400 (EDT) Date: Tue, 2 Aug 2005 10:28:55 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Poul-Henning Kamp In-Reply-To: <25679.1122992242@phk.freebsd.dk> 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: current@freebsd.org Subject: Re: pthreads: shouldn't nanosleep() be a cancellation point ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2005 14:28:59 -0000 On Tue, 2 Aug 2005, Poul-Henning Kamp wrote: > In message , Daniel Eisc > hen writes: > > >Hmm, the same could be said for sleep() in libc also, but we jump > >through hoops to allow the thread libraries override sleep() with > >their own cancellable version. I think this is in case libc wants > >to use sleep(), usleep(), nanosleep() internally and not introduce > >cancellation points into functions that shouldn't have them. > > usleep() calls _nanosleep() but I wonder if it shouldn't be > redirected into the thead libraraies like sleep/nanosleep ? Yes, I think we should just add a cancellable version of usleep() to libpthread/thread/thr_sleep.c. syslog() is a consumer of usleep(), but I think it really wants to use _usleep() or _nanosleep(). By using usleep() it introduces a cancellation point while holding a lock. Do you want to do the mods to libpthread and libthr (in libthr/thread/thr_syscalls.c) or do you want me to do them? -- DE