Example
- Thread A calls function F which acquires a reentrant lock for itself before proceeding
- Thread B calls function F which attempts to acquire a reentrant lock for itself but cannot due to one already outstanding, resulting in either a block (it waits), or a timeout if requested
- Thread A's F calls itself recursively. It already owns the lock, so it will not block itself (deadlock)
- Thread B's F is still waiting, or has caught the timeout and worked around it
- Thread A's F finishes and releases its lock
- Thread B's F can now acquire a reentrant lock and proceed if it was still waiting
Read more about this topic: Reentrant Mutex
Famous quotes containing the word example:
“Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.”
—Marcel Proust (18711922)
Related Phrases
Related Words