Re: [gtk-list] Problems with glib's gcond?
- From: Sebastian Wilhelmi <wilhelmi ira uka de>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Problems with glib's gcond?
- Date: Wed, 02 Feb 2000 08:36:55 +0000
Hi, Benjamin
> I'm having a problem with glib's gcond command. Are there
> known problems with the sample code in the reference documentation?
> Basically, I have 32 threads waiting on a gcond. And I have another
> thread which will send up to 10 gcond signals in under a second. Only
> the last signal is caught and handled, unless I put a sleep command in
> the loop. In other words, when many signals happen at around the same
> time, gcond seems to forget all but the last one.
It is not guaranteed, that after the signaling a waiting thread is waked up
immediately, so you might as well first send another data, thus _overwriting_
the previously sent one, but after that really two threads will be waked up,
one finding the pointer being zero and thus waiting. What you really need, is
a asyncronous queue. I've written such a thing a year ago. It is named
ORBitAsyncQueue and can be found here:
http://cvs.gnome.org/bonsai/cvsblame.cgi?file=ORBit/src/orb/Attic/orbit_thread_support.h&rev=MULTI_THREADED&root=/cvs/gnome
and
http://cvs.gnome.org/bonsai/cvsblame.cgi?file=ORBit/src/orb/Attic/orbit_thread_support.c&rev=MULTI_THREADED&root=/cvs/gnome
Bye,
Sebastian
--
Sebastian Wilhelmi | här ovanför alla molnen
mailto:wilhelmi@ira.uka.de | är himmlen sĺ förunderligt blĺ
http://goethe.ira.uka.de/~wilhelmi |
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]