ywkaras commented on a change in pull request #7611:
URL: https://github.com/apache/trafficserver/pull/7611#discussion_r597278048
##########
File path: include/tscore/ink_rwlock.h
##########
@@ -30,14 +30,20 @@
#pragma once
#include "tscore/ink_error.h"
+#include "tscore/ink_assert.h"
#include <pthread.h>
typedef pthread_rwlock_t ink_rwlock;
void ink_rwlock_init(ink_rwlock *rw);
void ink_rwlock_destroy(ink_rwlock *rw);
-static inline void
+// Instead of calling ink_rwlock_init(), an ink_rwlock instance can be
initialized with one of thsee values.
+//
+ink_rwlock const INK_RWLOCK_INIT =
PTHREAD_RWLOCK_INITIALIZER;
+ink_rwlock const INK_RWLOCK_INIT_NO_WRITER_STARVATION =
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP;
Review comment:
So PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP isn't defined on
FreeBSD. It's also not defined on MacOS. But this program,
https://github.com/ywkaras/MiscRepo/blob/master/WRITE_STARVE/x.cc , indicates
that pthread rwlocks on MacOS avoid writer starvation by default. Can somebody
run this program on FreeBSD and check if it outputs "good" or "bad"?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]