#ifndef __SYNCH_INTERNAL_H__
#define __SYNCH_INTERNAL_H__
+// kwe_state
+enum {
+ KWE_THREAD_INWAIT = 1,
+ KWE_THREAD_PREPOST,
+ KWE_THREAD_BROADCAST,
+};
#define _PTHREAD_MTX_OPT_PSHARED 0x010
#define _PTHREAD_MTX_OPT_NOTIFY 0x1000 /* notify to drop mutex handling in cvwait */
#define is_rwl_readoverlap(x) (((x) & PTH_RWL_MBIT) != 0)
// S word tests
-#define is_rws_setseq(x) (((x) & PTH_RWS_SBIT))
-#define is_rws_setunlockinit(x) (((x) & PTH_RWS_IBIT))
+#define is_rws_sbit_set(x) (((x) & PTH_RWS_SBIT) != 0)
+#define is_rws_unlockinit_set(x) (((x) & PTH_RWS_IBIT) != 0)
+#define is_rws_savemask_set(x) (((x) & PTHRW_RWS_SAVEMASK) != 0)
+#define is_rws_pbit_set(x) (((x) & PTH_RWS_CV_PBIT) != 0)
+
+// kwe_flags
+#define KWE_FLAG_LOCKPREPOST 0x1 // cvwait caused a lock prepost
static inline int
is_seqlower(uint32_t x, uint32_t y)