When to use recursive mutex?
问题 I understand recursive mutex allows mutex to be locked more than once without getting to a deadlock and should be unlocked the same number of times. But in what specific situations do you need to use a recursive mutex? I\'m looking for design/code-level situations. 回答1: For example when you have function that calls it recursively, and you want to get synchronized access to it: void foo() { ... mutex_acquire(); ... foo(); ... mutex_release(); } without a recursive mutex you would have to