Re: [gtk-list] Re: Problems with glib's gcond?



On Wed, 2 Feb 2000, Sebastian Wilhelmi wrote:
> >         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:
> 
> [modified so others can download as well. --BDK]
>
> export CVSROOT=':pserver:anonymous@anoncvs.gnome.org:/cvs/gnome'
> cvs login
> cvs -z3 co ORBit -r MULTI_THREADED
>
>  in ORBit/src/orb/orbit_thread_support.[ch]

	Hmm...  This worked great, and was exactly what I needed.  I've
renamed the functions from ORBit_async_queue_* to OB_async_queue_* and
left the g_async_queue aliases in place.  I've also removed the custom
threading stuff in the files.  As it is, this would be really easy to
apply directly into glib.  

This has fixed a lot of bugs I was having.  Is there any reason this ISN'T
in glib?  I can almost see the argument againt putting this in glib 1.2.7,
but what about the next version of glib?  This seems like a generally
useful thread function.

						-Ben

------------------------------------ |\      _,,,--,,_  ,) ----------
Benjamin Kahn                        /,`.-'`'   -,  ;-;;'
(212) 924 - 2220 ext 201            |,4-  ) )-,_ ) /\
ben@cybersites.com --------------- '---''(_/--' (_/-' ---------------
	Q: Why does it crash?
	A: Woah! You should have seen it last week! 
	    -- Linux NETFILTER-HOWTO



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]