Repository: thrift
Updated Branches:
  refs/heads/master c063b30ec -> 7bc943196


THRIFT-4151: disable pthread concurrency analysis code in standard builds
Client: C++

This closes #1229


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/7bc94319
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/7bc94319
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/7bc94319

Branch: refs/heads/master
Commit: 7bc943196d90a1480d1631c330b03ae6ee479ce8
Parents: c063b30
Author: James E. King, III <jk...@apache.org>
Authored: Fri Mar 31 21:25:20 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Fri Mar 31 21:25:20 2017 -0400

----------------------------------------------------------------------
 lib/cpp/README.md                        |  7 +++++++
 lib/cpp/src/thrift/concurrency/Mutex.cpp | 15 +++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/7bc94319/lib/cpp/README.md
----------------------------------------------------------------------
diff --git a/lib/cpp/README.md b/lib/cpp/README.md
index 2bee2ec..05aef95 100755
--- a/lib/cpp/README.md
+++ b/lib/cpp/README.md
@@ -272,3 +272,10 @@ OpenSSL's RAND_poll() when OpenSSL library is first 
initialized.
 
 The PRNG seed is key to the application security. This method should be
 overridden if it's not strong enough for you.
+
+# Breaking Changes
+
+## 0.11.0
+
+In the pthread mutex implementation, the contention profiling code was enabled
+by default in all builds.  This changed to be disabled by default.  
(THRIFT-4151)

http://git-wip-us.apache.org/repos/asf/thrift/blob/7bc94319/lib/cpp/src/thrift/concurrency/Mutex.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/concurrency/Mutex.cpp 
b/lib/cpp/src/thrift/concurrency/Mutex.cpp
index e5e50f7..b6b915d 100644
--- a/lib/cpp/src/thrift/concurrency/Mutex.cpp
+++ b/lib/cpp/src/thrift/concurrency/Mutex.cpp
@@ -35,7 +35,10 @@ namespace apache {
 namespace thrift {
 namespace concurrency {
 
-#ifndef THRIFT_NO_CONTENTION_PROFILING
+// Enable this to turn on mutex contention profiling support
+// #define THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
+
+#ifdef THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
 
 static int32_t mutexProfilingCounter = 0;
 static int32_t mutexProfilingSampleRate = 0;
@@ -105,7 +108,7 @@ static inline int64_t maybeGetProfilingStartTime() {
 #define PROFILE_MUTEX_LOCKED()
 #define PROFILE_MUTEX_START_UNLOCK()
 #define PROFILE_MUTEX_UNLOCKED()
-#endif // THRIFT_NO_CONTENTION_PROFILING
+#endif // THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
 
 /**
  * Implementation of Mutex class using POSIX mutex
@@ -115,7 +118,7 @@ static inline int64_t maybeGetProfilingStartTime() {
 class Mutex::impl {
 public:
   impl(Initializer init) : initialized_(false) {
-#ifndef THRIFT_NO_CONTENTION_PROFILING
+#ifdef THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
     profileTime_ = 0;
 #endif
     init(&pthread_mutex_);
@@ -186,7 +189,7 @@ public:
 private:
   mutable pthread_mutex_t pthread_mutex_;
   mutable bool initialized_;
-#ifndef THRIFT_NO_CONTENTION_PROFILING
+#ifdef THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
   mutable int64_t profileTime_;
 #endif
 };
@@ -269,7 +272,7 @@ void Mutex::RECURSIVE_INITIALIZER(void* arg) {
 class ReadWriteMutex::impl {
 public:
   impl() : initialized_(false) {
-#ifndef THRIFT_NO_CONTENTION_PROFILING
+#ifdef THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
     profileTime_ = 0;
 #endif
     int ret = pthread_rwlock_init(&rw_lock_, NULL);
@@ -312,7 +315,7 @@ public:
 private:
   mutable pthread_rwlock_t rw_lock_;
   mutable bool initialized_;
-#ifndef THRIFT_NO_CONTENTION_PROFILING
+#ifdef THRIFT_PTHREAD_MUTEX_CONTENTION_PROFILING
   mutable int64_t profileTime_;
 #endif
 };

Reply via email to