Mutexes enforce mutual exclusion to critical sections. When a thread attempts to acquire a mutex held by another thread using mutex_lock(3C)
or pthread_mutex_lock(3C)
, it will determine if the owning thread is running on a different CPU. If it is, the acquiring thread will spin for a short while waiting for the mutex to become available. If the owner is not executing on another CPU, the acquiring thread will block.
The four plockstat
probes pertaining to mutexes are listed in Table 31–1. For each probe, arg0
contains a pointer to the mutex_t
or pthread_mutex_t
structure (these are identical types) that represents the mutex.
Table 31.1. Mutex Probes
|
Hold event probe that fires immediately after a mutex is acquired. |
|
Contention event probe that fires before a thread blocks on a held mutex. Both |
|
Contention event probe that fires before a thread begins spinning on a held mutex. Both |
|
Hold event probe that fires immediately after an mutex is released. |
|
Error event probe that fires when an error is encountered on a mutex operation. |