In most OpenSAF agent code, the mutex would be destroyed while it is being locked by other threads.
/* destroy the lock */ m_NCS_LOCK_DESTROY(&cb->cb_lock);
When the other threads come to unlock the mutex, EPERM or EINVAL will be returned.
1) EPERM: when being-locked mutex is destroyed and replaced by the new one, unlocking on that mutex is actually same as unlocking on not-being-locked mutex.
2) EINVAL: the being-locked mutex has been desotroyed and not yet intialized.
In both cases, application will be crashed. One of them was already reported in the ticket [#2885].
Diff:
Related
Tickets:
#2885Diff: