]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virthread: Introduce virRWLockInitPreferWriter
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 19 Jul 2017 10:54:23 +0000 (12:54 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 24 Jul 2017 13:54:06 +0000 (15:54 +0200)
commit328bd24443d2a345a5832ee48ebba0208f8036ea
treec5162a95b885c8ba67f21c63185948419777feba
parent64bebb2ba4033a3a1d9b040f9db560d84cb6ac10
virthread: Introduce virRWLockInitPreferWriter

We already have virRWLockInit. But this uses pthread defaults
which prefer reader to initialize the RW lock. This may lead to
writer starvation. Therefore we need to have the counterpart that
prefers writers. Now, according to the
pthread_rwlockattr_setkind_np() man page setting
PTHREAD_RWLOCK_PREFER_WRITER_NP attribute is no-op. Therefore we
need to use PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
attribute. So much for good enum value names.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/libvirt_private.syms
src/util/virthread.c
src/util/virthread.h