Sun, 9 Apr 2000 13:54:47 -0700, Sigbjorn Finne <[EMAIL PROTECTED]> pisze:

> > Wouldn't be nice to have such function?
> 
> Have you tried using Concurrent.isEmptyMVar ?

isEmptyMVar is not enough to implement tryTakeMVar (but tryTakeMVar
would suffice for isEmptyMVar). Just after checking that it is empty
I can't safely take the value out of it, because it could be taken
by another thread right between and I will sleep for a long time then.

tryTakeMVar is a safe variant of isEmptyMVar. The equivalent of
pthread_mutex_trylock and Mutex::try_lock in Ruby.

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to