From fc04cf750a312cb33c0be9e19f362f55f911b458 Mon Sep 17 00:00:00 2001 From: yanyiwu Date: Fri, 19 Feb 2016 16:14:33 +0800 Subject: [PATCH] upgrade limonp to v0.5.5 --- deps/limonp/Condition.hpp | 10 +++++----- deps/limonp/Logging.hpp | 16 ++++++++-------- deps/limonp/MutexLock.hpp | 10 +++++----- deps/limonp/Thread.hpp | 10 +++++----- deps/limonp/ThreadPool.hpp | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/deps/limonp/Condition.hpp b/deps/limonp/Condition.hpp index 547243c..656a61d 100644 --- a/deps/limonp/Condition.hpp +++ b/deps/limonp/Condition.hpp @@ -9,23 +9,23 @@ class Condition : NonCopyable { public: explicit Condition(MutexLock& mutex) : mutex_(mutex) { - CHECK(!pthread_cond_init(&pcond_, NULL)); + XCHECK(!pthread_cond_init(&pcond_, NULL)); } ~Condition() { - CHECK(!pthread_cond_destroy(&pcond_)); + XCHECK(!pthread_cond_destroy(&pcond_)); } void Wait() { - CHECK(!pthread_cond_wait(&pcond_, mutex_.GetPthreadMutex())); + XCHECK(!pthread_cond_wait(&pcond_, mutex_.GetPthreadMutex())); } void Notify() { - CHECK(!pthread_cond_signal(&pcond_)); + XCHECK(!pthread_cond_signal(&pcond_)); } void NotifyAll() { - CHECK(!pthread_cond_broadcast(&pcond_)); + XCHECK(!pthread_cond_broadcast(&pcond_)); } private: diff --git a/deps/limonp/Logging.hpp b/deps/limonp/Logging.hpp index bdeed26..d96ab18 100644 --- a/deps/limonp/Logging.hpp +++ b/deps/limonp/Logging.hpp @@ -7,15 +7,15 @@ #include #include -#ifdef LOG -#error "LOG has been defined already" -#endif // LOG -#ifdef CHECK -#error "CHECK has been defined already" -#endif // CHECK +#ifdef XLOG +#error "XLOG has been defined already" +#endif // XLOG +#ifdef XCHECK +#error "XCHECK has been defined already" +#endif // XCHECK -#define LOG(level) limonp::Logger(limonp::LL_##level, __FILE__, __LINE__).Stream() -#define CHECK(exp) if(!(exp)) LOG(FATAL) << "exp: ["#exp << "] false. " +#define XLOG(level) limonp::Logger(limonp::LL_##level, __FILE__, __LINE__).Stream() +#define XCHECK(exp) if(!(exp)) XLOG(FATAL) << "exp: ["#exp << "] false. " namespace limonp { diff --git a/deps/limonp/MutexLock.hpp b/deps/limonp/MutexLock.hpp index e2aca0e..ea10d6d 100644 --- a/deps/limonp/MutexLock.hpp +++ b/deps/limonp/MutexLock.hpp @@ -10,10 +10,10 @@ namespace limonp { class MutexLock: NonCopyable { public: MutexLock() { - CHECK(!pthread_mutex_init(&mutex_, NULL)); + XCHECK(!pthread_mutex_init(&mutex_, NULL)); } ~MutexLock() { - CHECK(!pthread_mutex_destroy(&mutex_)); + XCHECK(!pthread_mutex_destroy(&mutex_)); } pthread_mutex_t* GetPthreadMutex() { return &mutex_; @@ -21,10 +21,10 @@ class MutexLock: NonCopyable { private: void Lock() { - CHECK(!pthread_mutex_lock(&mutex_)); + XCHECK(!pthread_mutex_lock(&mutex_)); } void Unlock() { - CHECK(!pthread_mutex_unlock(&mutex_)); + XCHECK(!pthread_mutex_unlock(&mutex_)); } friend class MutexLockGuard; @@ -44,7 +44,7 @@ class MutexLockGuard: NonCopyable { MutexLock & mutex_; }; // class MutexLockGuard -#define MutexLockGuard(x) CHECK(false); +#define MutexLockGuard(x) XCHECK(false); } // namespace limonp diff --git a/deps/limonp/Thread.hpp b/deps/limonp/Thread.hpp index 2237bbd..4e3c084 100644 --- a/deps/limonp/Thread.hpp +++ b/deps/limonp/Thread.hpp @@ -12,19 +12,19 @@ class IThread: NonCopyable { } virtual ~IThread() { if(isStarted && !isJoined) { - CHECK(!pthread_detach(thread_)); + XCHECK(!pthread_detach(thread_)); } }; virtual void Run() = 0; void Start() { - CHECK(!isStarted); - CHECK(!pthread_create(&thread_, NULL, Worker, this)); + XCHECK(!isStarted); + XCHECK(!pthread_create(&thread_, NULL, Worker, this)); isStarted = true; } void Join() { - CHECK(!isJoined); - CHECK(!pthread_join(thread_, NULL)); + XCHECK(!isJoined); + XCHECK(!pthread_join(thread_, NULL)); isJoined = true; } private: diff --git a/deps/limonp/ThreadPool.hpp b/deps/limonp/ThreadPool.hpp index dda6bd9..fb0ee57 100644 --- a/deps/limonp/ThreadPool.hpp +++ b/deps/limonp/ThreadPool.hpp @@ -30,9 +30,9 @@ class ThreadPool: NonCopyable { try { closure->Run(); } catch(std::exception& e) { - LOG(ERROR) << e.what(); + XLOG(ERROR) << e.what(); } catch(...) { - LOG(ERROR) << " unknown exception."; + XLOG(ERROR) << " unknown exception."; } delete closure; }