After a thread A
has called unlock()
, releasing a mutex, it is possible for another
to lock the same mutex, observe that it is no longer in use, unlock it, and
destroy it, before thread A
appears to have returned from its unlock call.
are required to handle such scenarios correctly, as long as thread A
doesn't access the
mutex after the unlock call returns.
These cases typically occur when a reference-counted object
contains a mutex that is used to protect the reference count.
— end note