Date: Thu, 6 Aug 1998 09:02:19 +1000 (EST) From: John Birrell <jb@cimlogic.com.au> To: shmit@kublai.com Cc: current@FreeBSD.ORG Subject: Re: Pthreads woes Message-ID: <199808052302.JAA28909@cimlogic.com.au> In-Reply-To: <19980805180913.10635@kublai.com> from Brian Cully at "Aug 5, 98 06:09:13 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Brian Cully wrote: > I'm working on a program that spawns a bunch of threads in a pool, each > of which sits on a condition variable. The main thread waits for > a RADIUS request on a socket, it signals the condition variable on one > of the threads in the pool. > > The sequence of events is: > > main > ---------------------- > spawn threads > loop { > lock thread mutex > wait for packet > unlock mutex You keep the mutex locked while you wait? > send signal to thread Signal a condition or a kill() signal? > } > > threads > ---------------------- > loop { > wait for signal > do RADIUS crap > } > > The mutex in question is the same one as used by pthread_cond_wait. > > The problem is that I have to wake up the same thread /twice/ before > it answers a request (IOW, pthread_cond_signal is called twice before > the thread wakes up and `does RADIUS crap'). > > I haven't been able to reproduce this in something that isn't so > complicated (but I can give the full source to anyone who's interested), > but I was hoping someone might be able to tell me off-the-bat if it's > a known problem in some instances (or that it's a problem at all). I do this all the time. In fact I stopped working on such an application to answer your message. > > If not, I'll see what I can do to make the test simpler. Does the code build cleanly (gcc -Wall) on -current, without using a GNU configure script, and is it C code (not C++)? If yes, yes and yes, I'll look at it. -- John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/ CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808052302.JAA28909>