Today I came across the need for a recursive mutex, and, in my opinion, this is the simplest example among the published answers: This is a class that provides two API functions: Process (...) and reset ().
public void Process(...) { acquire_mutex(mMutex);
Both functions should not be launched at the same time, because they change the interiors of the class, so I wanted to use a mutex. The problem is that process () calls reset () internally and this will create a dead end because mMutex is already received. Instead, locking with a recursive lock fixes the problem.
Doktor Schrott May 08 '15 at 17:16 2015-05-08 17:16
source share