lock mtx locks
mtx, possibly waiting for it to be released
first by another thread.
lockattempts to acquire
try_lock is like
lock, but always returns immediately. If the calling thread or
another one already has the mutex it returns
it locks it and returns
unlock mtx unlocks
unlockattempts to release an unacquired mutex or a mutex held by another thread.
synchronize f creates a mutex and returns a new function that is identical to
except that the mutex is held during its execution.