Type:
Class
Mutex implements a simple semaphore that can be used to coordinate access to shared data from multiple concurrent threads.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | require 'thread' semaphore = Mutex. new a = Thread . new { semaphore.synchronize { # access shared resource } } b = Thread . new { semaphore.synchronize { # access shared resource } } |