ywkaras commented on a change in pull request #7611:
URL: https://github.com/apache/trafficserver/pull/7611#discussion_r597271610
##########
File path: include/tscore/ink_rwlock.h
##########
@@ -55,11 +74,134 @@ ink_rwlock_wrlock(ink_rwlock *rw)
}
}
-static inline void
+inline bool
+ink_rwlock_trywrlock(ink_rwlock *rw)
+{
+ int error = pthread_rwlock_trywrlock(rw);
+ if (EBUSY == error) {
+ return false;
+ }
+ if (unlikely(error != 0)) {
+ ink_abort("pthread_rwlock_trywrlock(%p) failed: %s (%d)", rw,
strerror(error), error);
+ }
+ return true;
+}
+
+inline void
ink_rwlock_unlock(ink_rwlock *rw)
{
int error = pthread_rwlock_unlock(rw);
if (unlikely(error != 0)) {
ink_abort("pthread_rwlock_unlock(%p) failed: %s (%d)", rw,
strerror(error), error);
}
}
+
+#ifdef X
+#error "X preprocessor symbol defined"
+#endif
+
+#ifdef DEBUG
+
+#define X(P) P
+
+#include <atomic>
+
+#else
+
+#define X(P)
+
+#endif
+
+namespace ts
+{
Review comment:
This class will allow us to eliminate this flag guarding against writer
starvation:
https://github.com/apache/trafficserver/blob/42db8bb284d63e3f019e2d9d986e4d34f750f69a/plugins/s3_auth/s3_auth.cc#L492
--
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]