Re: Are PR_Locks thread re-entrant?
"Wan-Teh Chang" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Sep 19, 2008 at 4:24 PM, Rich Megginson <[email protected]> wrote: > > Any suggestions? I need to allow re-entrant code in the same thread but > lock out other threads. It is best to rewrite the code so that it doesn't need re-entrant locks. You can implement a re-entrant lock yourself easily using a PRLock and a PRCondVar. PRMonitor is a re-entrant lock with a condition variable. It was originally intended for Java VM implementation (to implement Java's "synchronized" keyword and the wait, notify, and notifyAll methods of Object). Whenever I say the above, most people take the easy way out and use PRMonitor. Wan-Teh