Earlier this week, bug 1347963 landed, introducing a new
mozilla::RecursiveMutex type.  A RecursiveMutex instance may be
acquired on the same thread while said thread is already holding the
lock; such behavior with mozilla::Mutex would result in deadlocks.

While we already have a recursively-acquirable lock, ReentrantMonitor,
ReentrantMonitor does too much for many scenarios: it provides
condition variable-like semantics as well as recursive locking.  This
extra functionality makes ReentrantMonitor relatively slow;
RecursiveMutex provides only the locking functionality and should be
at least 2x faster than ReentrantMonitor, in addition to being
smaller.  Bug 1347963 converted several uses of ReentrantMonitor to
RecursiveMutex; the conversions were all straightforward.

If your code already uses ReentrantMonitor solely for its recursive
locking capabilities, please see whether converting to RecursiveMutex
would be feasible.

Thanks,
-Nathan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to