Mutex

This lesson discusses Mutex as used in Ruby.

We'll cover the following...

Mutex

Mutex is the most basic or primitive synchronization construct available in Ruby. It offers two methods: lock() and unlock(). A Mutex object can only be unlocked by a thread that locked it in the first place. Consider the snippet below, where the child and the main thread alternatively acquire the mutex. The main thread blocks for the period the child holds the mutex. ...