Date: Sat, 24 Oct 1998 07:10:01 -0700 (PDT) From: Daniel Eischen <eischen@vigrid.com> To: freebsd-bugs@FreeBSD.ORG Subject: Re: kern/8375: pthread_cond_wait() spins the CPU Message-ID: <199810241410.HAA02740@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/8375; it has been noted by GNATS. From: Daniel Eischen <eischen@vigrid.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810241410.HAA02740>