Date: Tue, 20 Oct 1998 13:52:22 -0400 (EDT) From: Alfred Perlstein <bright@hotjobs.com> To: HighWind Software Information <info@highwind.com> Cc: current@FreeBSD.ORG Subject: Re: Another Serious libc_r problem Message-ID: <Pine.BSF.4.05.9810201342340.18282-100000@porkfriedrice.ny.genx.net> In-Reply-To: <199810201618.MAA26576@highwind.com>
next in thread | previous in thread | raw e-mail | index | archive | help
urk, problem: pthread_cond_broadcast() locks, unqueues, unlocks, schedules then loops. this can cause incorrect behavior when: a thread initiates a broadcast and is prempted after unlocking but before emptying the queue, then during the loop to unqueue and schedule another thread waits on the conditional the thread that joins after the broadcast will be signaled, the broadcast should be atomic. a solution is to store the number of items in a queue. then the broadcast function can malloc that number of pthread_t objects and dequeue them into an array then release the lock and loop while scheduling. but this also causes problems if the sheduling is pre-empted and a thread is scheduled twice. i'll see what i can do about this, i think the real real solution is for the scheduler to be able to atomically dequeue a number of threads in a critical section of code. i apologize for my zealousness that lead to the not correct patch, i also apologize for thinking aloud on this list, but i'm hoping to bring up some valid points for those with more experiance to make sure all the bases are covered. sorry, Alfred Perlstein - Programmer, HotJobs Inc. - www.hotjobs.com -- There are operating systems, and then there's FreeBSD. -- http://www.freebsd.org/ 3.0-current On Tue, 20 Oct 1998, HighWind Software Information wrote: > > Hmmm. Now we got 3 patches. > > I am a little wary about Alfred's "broadcast" patch. Seems premature > optimization. I'd rather have something that is conservative first. > > Can someone with commit priviledges take a peek at this and add one > of these to the source? > > -Rob > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > 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?Pine.BSF.4.05.9810201342340.18282-100000>
