The GHC documentation on QSem is very sparse.  I
would like to give a thread exclusive access to a
resource.

My *guess* based on the documentation is that I
can create an exclusive lock using:

   logSem <- newQSem 1

And then any thread that wants to lock the
resource uses:

   withLogSem x = do waitQSem logSem; y <- x; signalQSem logSem; return y

as follows:

   withLogSem $ rotate curLogPos

Am I misunderstanding QSem?

-Alex-



_________________________________________________________________
S. Alexander Jacobson                  mailto:[EMAIL PROTECTED]
tel:917-770-6565                       http://alexjacobson.com
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to