[libcxx-commits] [libcxx] [libc++] add shared_recursive_mutex api (PR #82466)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 27 00:21:45 PST 2024


================
@@ -0,0 +1,122 @@
+#include <cassert>
+#include <shared_recursive_mutex>
+
+constexpr uint32_t SHARED_USER_MAX_CNT = UINT32_MAX;
+constexpr pthread_t THREAD_ID_NOEXIST  = 0;
+
+using namespace std;
+
+#ifndef likely
+#  define likely(condition) __builtin_expect(!!(condition), 1)
+#endif
+#ifndef unlikely
+#  define unlikely(condition) __builtin_expect(!!(condition), 0)
+#endif
----------------
frederick-vs-ja wrote:

These don't seem necessary as compilers should support `[[likely]]` and `[[unlikely]]` (`[[__likely__]]` and `[[__unlikely__]]` in old modes).

https://github.com/llvm/llvm-project/pull/82466


More information about the libcxx-commits mailing list