#define ENDMAC } while (0)
#ifdef AFS_PTHREAD_ENV
-#include <pthread.h>
#include <afs/opr.h>
-#define LOCK_LOCK(A) opr_Verify(pthread_mutex_lock(&(A)->mutex));
-#define LOCK_UNLOCK(A) opr_Verify(pthread_mutex_unlock(&(A)->mutex));
+#include <opr/lock.h>
+#define LOCK_LOCK(A) opr_mutex_enter(&(A)->mutex)
+#define LOCK_UNLOCK(A) opr_mutex_exit(&(A)->mutex)
#else /* AFS_PTHREAD_ENV */
#define LOCK_LOCK(A)
#define LOCK_UNLOCK(A)
LOCK_UNLOCK(lock); \
ENDMAC
-#ifdef notdef
-/* this is what UnboostSharedLock looked like before the hi-C compiler */
-/* this must only be called with a WRITE or boosted SHARED lock! */
-#define UnboostSharedLock(lock)\
- ((lock)->excl_locked = SHARED_LOCK,\
- ((lock)->wait_states ?\
- Afs_Lock_ReleaseR(lock) : 0))
-#endif /* notdef */
-
#define ReleaseReadLock(lock)\
BEGINMAC\
LOCK_LOCK(lock); \
ENDMAC
-#ifdef notdef
-/* This is what the previous definition should be, but the hi-C compiler generates
- a warning for each invocation */
-#define ReleaseReadLock(lock)\
- (!--(lock)->readers_reading && (lock)->wait_states ?\
- Afs_Lock_ReleaseW(lock) :\
- 0)
-#endif /* notdef */
-
#define ReleaseWriteLock(lock)\
BEGINMAC\
LOCK_LOCK(lock); \
LOCK_UNLOCK(lock); \
ENDMAC
-#ifdef notdef
-/* This is what the previous definition should be, but the hi-C compiler generates
- a warning for each invocation */
-#define ReleaseWriteLock(lock)\
- ((lock)->excl_locked &= ~WRITE_LOCK,\
- ((lock)->wait_states ?\
- Afs_Lock_ReleaseR(lock) : 0))
-#endif /* notdef */
-
/* can be used on shared or boosted (write) locks */
#define ReleaseSharedLock(lock)\
BEGINMAC\
LOCK_UNLOCK(lock); \
ENDMAC
-#ifdef notdef
-/* This is what the previous definition should be, but the hi-C compiler generates
- a warning for each invocation */
-/* can be used on shared or boosted (write) locks */
-#define ReleaseSharedLock(lock)\
- ((lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK),\
- ((lock)->wait_states ?\
- Afs_Lock_ReleaseR(lock) : 0))
-#endif /* notdef */
-
/* convert a write lock to a read lock */
#define ConvertWriteToReadLock(lock)\
BEGINMAC\
#define WriteLocked(lock)\
((lock)->excl_locked & WRITE_LOCK)
+#define SharedLocked(lock)\
+ ((lock)->excl_locked & SHARED_LOCK)
+
#endif /* LOCK_H */