Search code examples
c++nspr

What is difference b/w PRLock and PRRWLock


What is the difference b/w PRLock and PRRWLock provided by nspr library ?


Solution

  • I don't know anything about the library but the names suggest that one is a standard lock and the other is a reader/writer lock. The first always gives exclusive access, and the second allows multiple concurrent reads but exclusive writes. For example, pthreads api has pthread_mutex_lock/pthread_mutex_unlock and pthread_rwlock_rdlock/pthread_rwlock_wrlock methods.