← BYTES
Unix IPC·Starter·Ref: 15.1.77
What is a recursive mutex?
Have a question about this video? Mention reference 15.1.77 when you contact us.
Thread A: lock() --> lock() again --> OK! (same thread, count=2)
unlock() --> unlock() --> now fully releaseda.A mutex that the SAME thread may lock multiple times in a row without deadlocking itself, as long as it unlocks it the same number of times before any other thread can acquire it
b.A mutex that can only be locked exactly once in a program's entire lifetime
c.A mutex that automatically unlocks itself every time a function returns
d.A type of mutex that can be shared across different programming languages
A recursive mutex specifically tracks both WHICH thread owns it and HOW MANY times that same thread has locked it, allowing that owning thread to re-lock it (e.g. from a function that calls another function also needing the same lock) without the self-deadlock a plain mutex would suffer -- it must be unlocked the same number of times before another thread can take it.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES15177#UnixIPC