summaryrefslogtreecommitdiff
path: root/lib/cpp/src/thrift/concurrency/Thread.h
diff options
context:
space:
mode:
authorKonrad Grochowski <hcorg@apache.org>2014-11-18 11:33:31 +0100
committerKonrad Grochowski <hcorg@apache.org>2014-11-18 11:33:31 +0100
commit240120c8434b49d1f76d207aff4e3530d3ada14b (patch)
tree98cdcc1834ff0d96ef40fe4e927aa607af5c578e /lib/cpp/src/thrift/concurrency/Thread.h
parent74260aa9099c3bb209bc8e524b0e8ba603f62c41 (diff)
downloadthrift-240120c8434b49d1f76d207aff4e3530d3ada14b.tar.gz
Revert "THRIFT-2729: C++ - .clang-format created and applied"
This reverts commit 74260aa9099c3bb209bc8e524b0e8ba603f62c41.
Diffstat (limited to 'lib/cpp/src/thrift/concurrency/Thread.h')
-rwxr-xr-x[-rw-r--r--]lib/cpp/src/thrift/concurrency/Thread.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/cpp/src/thrift/concurrency/Thread.h b/lib/cpp/src/thrift/concurrency/Thread.h
index 1d9153fa5..70129338f 100644..100755
--- a/lib/cpp/src/thrift/concurrency/Thread.h
+++ b/lib/cpp/src/thrift/concurrency/Thread.h
@@ -27,18 +27,16 @@
#include <thrift/thrift-config.h>
#if USE_BOOST_THREAD
-#include <boost/thread.hpp>
+# include <boost/thread.hpp>
#elif USE_STD_THREAD
-#include <thread>
+# include <thread>
#else
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
+# ifdef HAVE_PTHREAD_H
+# include <pthread.h>
+# endif
#endif
-namespace apache {
-namespace thrift {
-namespace concurrency {
+namespace apache { namespace thrift { namespace concurrency {
class Thread;
@@ -49,8 +47,8 @@ class Thread;
*/
class Runnable {
-public:
- virtual ~Runnable(){};
+ public:
+ virtual ~Runnable() {};
virtual void run() = 0;
/**
@@ -65,7 +63,7 @@ public:
*/
virtual void thread(boost::shared_ptr<Thread> value) { thread_ = value; }
-private:
+ private:
boost::weak_ptr<Thread> thread_;
};
@@ -80,7 +78,8 @@ private:
*/
class Thread {
-public:
+ public:
+
#if USE_BOOST_THREAD
typedef boost::thread::id id_t;
@@ -98,7 +97,7 @@ public:
static inline id_t get_current() { return pthread_self(); }
#endif
- virtual ~Thread(){};
+ virtual ~Thread() {};
/**
* Starts the thread. Does platform specific thread creation and
@@ -123,11 +122,12 @@ public:
*/
virtual boost::shared_ptr<Runnable> runnable() const { return _runnable; }
-protected:
+ protected:
virtual void runnable(boost::shared_ptr<Runnable> value) { _runnable = value; }
-private:
+ private:
boost::shared_ptr<Runnable> _runnable;
+
};
/**
@@ -136,19 +136,17 @@ private:
*/
class ThreadFactory {
-public:
+ public:
virtual ~ThreadFactory() {}
virtual boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const = 0;
- /** Gets the current thread id or unknown_thread_id if the current thread is not a thrift thread
- */
+ /** Gets the current thread id or unknown_thread_id if the current thread is not a thrift thread */
static const Thread::id_t unknown_thread_id;
virtual Thread::id_t getCurrentThreadId() const = 0;
};
-}
-}
-} // apache::thrift::concurrency
+
+}}} // apache::thrift::concurrency
#endif // #ifndef _THRIFT_CONCURRENCY_THREAD_H_