gthread: Fix g_rw_lock_reader_lock() documentation

The documentation erroneously said that a thread calling
g_rw_lock_reader_lock() would always block if another thread was waiting
for the write lock. That’s not true: if no thread holds the lock, it is
implementation defined which of a waiting reader and writer gets the
lock.

See
http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_rwlock_rdlock.html.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #590
This commit is contained in:
Philip Withnall 2019-05-31 21:36:34 +01:00
parent e6a55def7d
commit 231661e46c

View File

@ -587,8 +587,10 @@ g_rw_lock_writer_unlock (GRWLock *rw_lock)
* @rw_lock: a #GRWLock
*
* Obtain a read lock on @rw_lock. If another thread currently holds
* the write lock on @rw_lock or blocks waiting for it, the current
* thread will block. Read locks can be taken recursively.
* the write lock on @rw_lock, the current thread will block. If another thread
* does not hold the write lock, but is waiting for it, it is implementation
* defined whether the reader or writer will block. Read locks can be taken
* recursively.
*
* It is implementation-defined how many threads are allowed to
* hold read locks on the same lock simultaneously. If the limit is hit,