Re: GEvent - Proposal for a new threading structure for GLib

On Fri, 2006-11-17 at 12:27 -0500, mark mark mielke cc wrote:
> Isn't this what a semaphore is?

A GEvent is essentially a binary semaphore, yes.  With perhaps a more
intuitive name.

> I would suggest that somebody look at what the full requirements are,
> and not mimic Python. :-)
> I think a semaphore does what you are asking for, and can be implemented
> more efficiently. One person raises the flag, and the other person wakes
> up because the flag is raised. There are a few ways to do this...

A more general purpose counting semaphore might also be a nice addition
to GLib.  I proposed a binary semaphore because in practice I find
myself reimplementing that little guy far more frequently than any other
synchronization mechanism.  Probably why it got into Python.

There may well be a more efficient implementation than what I proposed.
That's why I'm looking for feedback.  I just formalized the way
application developers would likely hand-code it, given the GLib's
current selection of threading primitives.

Matthew Barnes

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