|
From: Frank V. C. <fr...@co...> - 2000-08-25 10:55:33
|
Hans - Dulimarta wrote: > > I'm implementing EventSemaphore in the following setup: > > Assuming we have three operations: down(), up(), and zero(). Are these the actual interface method names? While I don't feel the requirements document quite addresses is, the semantics of an Event are things more like hold/trigger/waitFor > When an EvSem is created, its value is initialized to 1 indicating the > expected event has not occured. I assume this is 'up', which I would consider 'hold'. > Any callers who are waiting for the event to occur will do a "lock" > by calling zero(). When the event actually takes place, the semaphore will > be released via the down() operation. Terminology shift, callers 'waitFor' events no? and the owner 'triggers' them (to trigger an Event)? > The requirement document (SRS ?) for says that the Many-to-One semaphores > will automatically lock upon creation and there is no option to create in > unlock. When I look at the code, lock is similar to down() semaphore > operation which implies that the creator will be block in the middle of > the EventSemaphore ctor. > > In the context of the above three operations, how can the creator perform > a release operation to indicate that the expected event has occured? There are two things to consider here: 1. As the SemaphoreGroup instantiates the creation of the Semaphore (in this case EventSemaphore), it can construct and then call 'hold'. 2. The owner of a semaphore is not in a blocked state, the Linux kernel semaphore has a state change, but the owner is not blocked. Only those callers 'waiting for' an event are blocked. Hope this helps. > -- > Hans Dulimarta, Ph.D. dul...@co... > P: 517-432-7589 http://www.egr.msu.edu/~dulimart > F: 760-281-7691 http://corelinux.sourceforge.net > Elec. & Comp. Engg., Mich. State Univ., E. Lansing, MI 48824 > > _______________________________________________ > Corelinux-develop mailing list > Cor...@li... > http://lists.sourceforge.net/mailman/listinfo/corelinux-develop -- Frank V. Castellucci |