pyuv.thread — Thread synchronization primitives¶
-
class
pyuv.thread.Barrier(count)¶ Parameters: count (int) – Initialize the barrier for the given amount of threads -
wait()¶ Synchronize all the participating threads at the barrier.
-
-
class
pyuv.thread.Mutex¶ -
lock()¶ Lock this mutex.
-
unlock()¶ Unlock this mutex.
-
trylock()¶ Try to lock the mutex. If the lock could be acquired True is returned, False otherwise.
-
-
class
pyuv.thread.RWLock¶ -
rdlock()¶ Lock this rwlock for reading.
-
rdunlock()¶ Unlock this rwlock for reading.
-
tryrdlock()¶ Try to lock the rwlock for reading. If the lock could be acquired True is returned, False otherwise.
-
wrlock()¶ Lock this rwlock for writing.
-
wrunlock()¶ Unlock this rwlock for writing.
-
trywrlock()¶ Try to lock the rwlock for writing. If the lock could be acquired True is returned, False otherwise.
-
-
class
pyuv.thread.Condition(lock)¶ Parameters: lock (Mutex) – Lock to be used by this condition. -
signal()¶ Unblock at least one of the threads that are blocked on this condition.
-
broadcast()¶ Unblock all threads blocked on this condition.
-
wait()¶ Block on this condition variable, the mutex lock must be held.
-
timedwait(timeout)¶ Parameters: timeout (double) – Time to wait until condition is met before giving up. Wait for the condition to be met, give up after the specified timeout.
-
-
class
pyuv.thread.Semaphore(count=1)¶ Parameters: count (int) – Initialize the semaphore with the given counter value. -
post()¶ Increment (unlock) the semaphore.
-
wait()¶ Decrement (lock) the semaphore.
-
trywait()¶ Try to decrement (lock) the semaphore. If the counter could be decremented True is returned, False otherwise.
-