This is a friendly reminder that you should not be using NSPR
synchronization primitives in new Gecko code unless you have a very good
reason to.  We built all these nice wrappers on them that provide deadlock
checking, RAII, leak checking, etc. that you should use instead.

Instead of
PRLock - use xpcom/glue/Mutex.h a non-recursive mutex with RAII helpers for
scoped locking/unlocking.
PRCondVar - use xpcom/glue/CondVar.h basically a shim wrapper over PRCondVar
PRLock+PRCondVar - use xpcom/glue/Monitor.h a non-reentrant (i.e. different
from Java) monitor with RAII helpers for scoped locking/unlocking and all
the condvar methods
PRMonitor - use xpcom/glue/ReentrantMonitor.h a reentrant (Java style)
monitor with RAII helpers for scoped locking/unlocking and all the condvar
methods.  You shouldn't use a reentrant monitor unless you absolutely need
it.

All of these wrappers provide deadlock checking, leak checking, RAII
lock/unlock helpers, and methods for asserting ownership or lack there of
on the current thread (in various states of implementation).  Unless there
is an extremely compelling reason Gecko code should be using these and not
raw NSPR synchronization primitives.

Gecko reviewers should be enforcing this.

- Kyle
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to