Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PRRWLock is not documented in MDC

1 view
Skip to first unread message

Sabyasachi Ruj

unread,
May 8, 2008, 6:10:23 AM5/8/08
to
Hi,

I found that there is inbuilt support for reader-writer lock in libnspr
using PRRWLock.
I am confused about using it, because it is not documented in Mozilla
Development Center.
Is there any problem in using it?
I found the documentation in 'prrwlock.h' in the include directory of nspr.
But not in MDC.

One more question: How is this implemented? Using 1) Locks and conditional
variables or, 2) Semaphores?
I want to avoid semaphores as much as possible.

The documentation of PR_NewRWLock says: "If the lock cannot be created
because of resource constraints, NULL is returned."
That is my second consideration. If it is implemented using semaphore, I can
not create a lot of locks. I need at about 500 locks.

--
Regards,
Sabyasachi.


Wan-Teh Chang

unread,
May 8, 2008, 10:13:41 AM5/8/08
to dev-te...@lists.mozilla.org
You can use PRRWLock. It turns out the lack of documentation for
PRRWLock is an old known bug, sigh:
https://bugzilla.mozilla.org/show_bug.cgi?id=87200

Please use the comments in "prrwlock.h" as the documentation for now.

PRRWLock is implemented using:
- the native reader-writer locks, if they exist (right now HP-UX and
Solaris only), or
- NSPR locks and conditional variables.

It is not implemented using semaphores.

Wan-Teh

Nelson Bolyard

unread,
May 8, 2008, 11:46:33 PM5/8/08
to
Sabyasachi Ruj wrote, On 2008-05-08 03:10:
> Hi,
>
> I found that there is inbuilt support for reader-writer lock in libnspr
> using PRRWLock.
> I am confused about using it, because it is not documented in Mozilla
> Development Center.
> Is there any problem in using it?
> I found the documentation in 'prrwlock.h' in the include directory of nspr.
> But not in MDC.
>
> One more question: How is this implemented?

See http://lxr.mozilla.org/nspr/source/nsprpub/pr/src/threads/prrwlock.c#70

0 new messages