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.
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
See http://lxr.mozilla.org/nspr/source/nsprpub/pr/src/threads/prrwlock.c#70