Skip to content

Commit

Permalink
Fix unused private field warning of FastPthreadMutex
Browse files Browse the repository at this point in the history
  • Loading branch information
chenBright committed Dec 9, 2024
1 parent f187d2c commit 3c3d6cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/bthread/mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ void submit_contention(const bthread_contention_site_t& csite, int64_t now_ns) {
}

#if BRPC_DEBUG_LOCK
#define MUTEX_RESET_OWNER_COMMON(owner) \
#define MUTEX_RESET_OWNER_COMMON(owner) \
((butil::atomic<bool>*)&(owner).hold) \
->store(false, butil::memory_order_relaxed)

Expand All @@ -678,9 +678,9 @@ void submit_contention(const bthread_contention_site_t& csite, int64_t now_ns) {
<< std::endl << trace.ToString(); \
}
#else
#define MUTEX_RESET_OWNER_COMMON(owner) ((void)0)
#define PTHREAD_MUTEX_SET_OWNER(owner) ((void)0)
#define PTHREAD_MUTEX_CHECK_OWNER(owner) ((void)0)
#define MUTEX_RESET_OWNER_COMMON(owner) ((void)owner)
#define PTHREAD_MUTEX_SET_OWNER(owner) ((void)owner)
#define PTHREAD_MUTEX_CHECK_OWNER(owner) ((void)owner)
#endif // BRPC_DEBUG_LOCK

namespace internal {
Expand Down
2 changes: 1 addition & 1 deletion src/bthread/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FastPthreadMutex {
// Note: Owner detection of the mutex comes with average execution
// slowdown of about 50%., so it is only used for debugging and is
// only available when the macro `BRPC_DEBUG_LOCK' = 1.
mutex_owner_t _owner;
mutex_owner_t ALLOW_UNUSED _owner;
};
#else
typedef butil::Mutex FastPthreadMutex;
Expand Down

0 comments on commit 3c3d6cc

Please sign in to comment.