PTHREAD_MUTEX_DEFAULT - Produces undefined behavior in exceptional
cases
PTHREAD_MUTEX_ERROR_CHECK - Error codes returned for exceptional
cases
Mutex Types
PTHREAD_MUTEX_NORMAL - Self-deadlocks are possible. Produces
undefined behavior in other cases
PTHREAD_MUTEX_RECURSIVE - A counter is used for lock state. A mutex
can be locked multiple times and must be unlocked the same number of
times before truly being unlocked
Monitors
OOP approach to thread safety
Provide more structured mutexes
Monitor Objects
All state is private
Objects include a mutex in addition to their state
Every public method begins by locking the mutex and ends by
unlocking it
Races
A race on object state will be impossible if the object is a
monitor
Language support
Can be automatic (e.g. class monitor)
syncronized
keyword provides object locking at the method level