Unverified Commit ef917408 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #631 from eric-buaa-cn/master

improve the readability of code
parents 77dedbef 655cc536
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
int64_t get_cumulated_signal_count(); int64_t get_cumulated_signal_count();
// [Not thread safe] Add more worker threads. // [Not thread safe] Add more worker threads.
// Return the number of workers actually added, which may be less then |num| // Return the number of workers actually added, which may be less than |num|
int add_workers(int num); int add_workers(int num);
// Choose one TaskGroup (randomly right now). // Choose one TaskGroup (randomly right now).
......
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
inline T* get_object() { inline T* get_object() {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->get(); return lp->get();
} }
return NULL; return NULL;
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
template <typename A1> template <typename A1>
inline T* get_object(const A1& arg1) { inline T* get_object(const A1& arg1) {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->get(arg1); return lp->get(arg1);
} }
return NULL; return NULL;
...@@ -240,7 +240,7 @@ public: ...@@ -240,7 +240,7 @@ public:
template <typename A1, typename A2> template <typename A1, typename A2>
inline T* get_object(const A1& arg1, const A2& arg2) { inline T* get_object(const A1& arg1, const A2& arg2) {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->get(arg1, arg2); return lp->get(arg1, arg2);
} }
return NULL; return NULL;
...@@ -248,7 +248,7 @@ public: ...@@ -248,7 +248,7 @@ public:
inline int return_object(T* ptr) { inline int return_object(T* ptr) {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->return_object(ptr); return lp->return_object(ptr);
} }
return -1; return -1;
...@@ -378,7 +378,7 @@ private: ...@@ -378,7 +378,7 @@ private:
inline LocalPool* get_or_new_local_pool() { inline LocalPool* get_or_new_local_pool() {
LocalPool* lp = _local_pool; LocalPool* lp = _local_pool;
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp; return lp;
} }
lp = new(std::nothrow) LocalPool(this); lp = new(std::nothrow) LocalPool(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment