|
From: Hans D. <dul...@eg...> - 2000-08-22 05:19:49
|
Frank encouraged me to keep asking question and now I do :-).
I am trying to understand the SemaphoreCommon class and
would like to ask the following questions:
1. Why CSA is needed? Is it used for obtaining the key of semget()?
However, I also find SemaphoreGroup::tmpDir ("/tmp") and
SemaphoreGroup::tmpName (/tmp/clsgtemp.\d+) used by ftok to generate
the key, but I could not find the connection between CSA and ftok.
2. SemaphoreCommon defines members setLock and setUnLock which eventually
calls the Dijkstra's P()/down() and V()/up() operation.
To implement EventSemaphore, I am planning to use the "zero()"
operation,
that is semop with sembuf.sem_op set to 0.
Will it be apropriate? If, yes, should a new member "setZero()" be added
to SemaphoreCommon?
I also have a couple of comments:
1. SemaphoreCommon::setLock and SemaphoreCommon::setUnLock call
semop and pass 'ON' as the third actual parameter.
Semantically, 'ON' does not make sense to the call because
the third formal parameter of semop is 'number of semaphore operations'.
2. I think the constant ON and OFF in SemaphoreCommon are overloaded
for too many different context, in some cases sacrificing its semantics.
For instance, the semantic of "-ON" [minus ON] is not clear.
--
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
|