From owner-freebsd-bugs Sat Oct 24 07:10:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA14071 for freebsd-bugs-outgoing; Sat, 24 Oct 1998 07:10:05 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA14066 for ; Sat, 24 Oct 1998 07:10:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id HAA02740; Sat, 24 Oct 1998 07:10:01 -0700 (PDT) Date: Sat, 24 Oct 1998 07:10:01 -0700 (PDT) Message-Id: <199810241410.HAA02740@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: Daniel Eischen Subject: Re: kern/8375: pthread_cond_wait() spins the CPU Reply-To: Daniel Eischen Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/8375; it has been noted by GNATS. From: Daniel Eischen To: dima@tejblum.dnttm.rssi.ru, eischen@vigrid.com Cc: freebsd-gnats-submit@FreeBSD.ORG, jb@FreeBSD.ORG Subject: Re: kern/8375: pthread_cond_wait() spins the CPU Date: Sat, 24 Oct 1998 09:54:39 -0400 (EDT) > > I don't see any other way of making pthread_cond_[timed]wait > > bulletproof without disabling scheduling. You shouldn't > > allow nesting of spinlocks being taken if there is a chance > > of creating a deadlock. Let's assume that you do not nest > > the condition variable and mutex spinlocks. > > Why? Frankly, I don't see any harm here. Sure, it is not safe to > _SPINUNLOCK the condition lock before pthread_mutex_unlock. So it has to be > done in other way around. I thought I found a way that you could get a deadlock condition here, but it's early in the morning here and I can't see how it could happen anymore. Surely after the thread returns from _thread_kern_sched_state you don't want to relock (spinlock) the condition variable. That fixes the original problem posted. Dan Eischen eischen@vigrid.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message