mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +00:00
lib/ovs-thread: set prefer writer lock for ovs_rwlock_init()
An alternative "writer nonrecursive" rwlock allows recursive read-locks to succeed only if there are no threads waiting for the write-lock. In the function ovs_rwlock_init(), there exist a problem, the parameter of 'attr' is not used to set the attributes of ovs_rwlock 'l_', just because use pthread_rwlock_init(&l->lock, NULL) to init l->lock. The attr object needs to be passed to the pthread_rwlock_init() call in order to make use of it. Signed-off-by: zangchuanqiang <zangchuanqiang@huawei.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
committed by
Ben Pfaff
parent
c4817da780
commit
1a15f390af
@@ -309,6 +309,7 @@ nickcooper-zhangtonghao nickcooper-zhangtonghao@opencloud.tech
|
||||
wisd0me ak47izatool@gmail.com
|
||||
xushengping shengping.xu@huawei.com
|
||||
yinpeijun yinpeijun@huawei.com
|
||||
zangchuanqiang zangchuanqiang@huawei.com
|
||||
=============================== ===============================================
|
||||
|
||||
The following additional people are mentioned in commit logs as having
|
||||
|
@@ -240,7 +240,7 @@ ovs_rwlock_init(const struct ovs_rwlock *l_)
|
||||
xpthread_rwlockattr_setkind_np(
|
||||
&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
#endif
|
||||
error = pthread_rwlock_init(&l->lock, NULL);
|
||||
error = pthread_rwlock_init(&l->lock, &attr);
|
||||
if (OVS_UNLIKELY(error)) {
|
||||
ovs_abort(error, "pthread_rwlock_init failed");
|
||||
}
|
||||
|
Reference in New Issue
Block a user