Re: async queue?



On Tue, Dec 11, 2001 at 11:41:32AM +0100, Mathieu Lacage wrote:
> le mar 11-12-2001 à 08:30, Mark Mielke a écrit :
> > 2) The Async Queue code should actually use two conditionials instead
> >    of one after implementing the above code. One conditional is used
> >    to wake up threads that are waiting to pop, while the other conditional
> >    is used to wake up threads that are waiting to push.
> I do not think this kind of object will ever exist in glib because it
> would involve 2 semaphores and a critical section and I doubt people
> would be willing to get this overhead when using the data structure in a
> non-multithreaded environment.
> (I personally would love to see it but... :)

One mutex, and two conditionals, as opposed to one mutex and one
conditional. For 'overhead', it's only a few extra bytes to ensure
that one thread doesn't runaway, while the other thread makes its
best effort to compete.

> As a side note, you refered to the "Async Queue" and what you want is a
> "Sync Queue" so, I guess you definitely should create your own version
> of a "Sync Queue"

This is rather interesting of a suggestion, however I'm not certain
that it is correct. I don't want a 'sync queue', except under the
situation that the 'async queue' would grow without bounds.

mark

-- 
mark mielke cc/markm ncf ca/markm nortelnetworks com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/




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