From owner-freebsd-arch Thu Dec 27 13: 0:54 2001 Delivered-To: freebsd-arch@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id D0C5F37B417; Thu, 27 Dec 2001 13:00:51 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.12.1/8.12.1) id fBRKxjDR014013; Thu, 27 Dec 2001 15:59:45 -0500 (EST) Date: Thu, 27 Dec 2001 15:59:45 -0500 (EST) From: Daniel Eischen To: Julian Elischer Cc: Mike Smith , Alfred Perlstein , arch@FreeBSD.ORG Subject: Re: the condvar stuff. In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 27 Dec 2001, Julian Elischer wrote: > so, is there such a thing in > pthread condvars as an uncancellable condvar? Sort of. Cancellability is a separately managed thing. Threads have a cancel state and type. You can enable or disable the cancel state to allow or disallow cancellation, and you can set the cancel type to deferred or asynchronous cancellation. Threads in pthread_cond_wait, pthread_mutex_lock, etc, can be cancelled if their state and type allow them to be cancelled. They can also be signaled to allow a signal handler to run regardless of whether they are in a pthread_cond_wait, pthread_mutex_lock, etc., blocking condition. See pthread_setcancelstate, pthread_setcanceltype, etc. One thing about cancelling a thread in pthread_cond_wait is that the mutex is relocked by the thread after the cancellation. The thread needs to install a cleanup function (to be run at thread exit) that can unlock the mutex (see pthread_cleanup_push, pthread_cleanup_pop). I don't think you want all the cancellation facilities of the pthread library in the kernel. It is probably sufficient just to have the _sig synchronization variants (as Solaris seems to get by with this). Some might argue for being able to push thread cleanup handlers in the kernel, though... -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message