mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 20:06:18 +01:00
gthread: Clarify priority handling in GRWLock
As we use pthread_rwlock_*() to implement GRWLock (on Unix), the priority of readers vs writers when trying to acquire a lock already held by one reader with a writer queued, is unspecified. i.e. We don’t explicitly prioritise the pending readers to acquire the lock (and block the writer), or vice-versa. Whatever our implementation on other platforms, we must document the priority as unspecified, as that’s what happens on Unix and is the least restrictive API guarantee we can make. Prompted by https://stackoverflow.com/q/52661672/2931197. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
da8f1c6ac3
commit
321b9d3b79
@ -320,6 +320,10 @@
|
||||
* simultaneous read-only access (by holding the 'reader' lock via
|
||||
* g_rw_lock_reader_lock()).
|
||||
*
|
||||
* It is unspecified whether readers or writers have priority in acquiring the
|
||||
* lock when a reader already holds the lock and a writer is queued to acquire
|
||||
* it.
|
||||
*
|
||||
* Here is an example for an array with access functions:
|
||||
* |[<!-- language="C" -->
|
||||
* GRWLock lock;
|
||||
|
Loading…
Reference in New Issue
Block a user