diff options
author | Artem Nosach <ANosach@luxoft.com> | 2016-06-17 14:58:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 14:58:37 +0300 |
commit | 7e9a2198ad57f1d8a9da70402c4db4c7e53b9e3d (patch) | |
tree | 92785f58a4004b9fae1ec550e5fa12ebbb2410cb /src/components/utils/src/lock_posix.cc | |
parent | c28abf92bc3201160968ba83be72d2db46c5dc55 (diff) | |
parent | 7b817d1b7577586bb4a91fca7ba7ff3330103366 (diff) | |
download | sdl_core-7e9a2198ad57f1d8a9da70402c4db4c7e53b9e3d.tar.gz |
Merge pull request #587 from OHerasym/feature/adapt_logger_macroses
Adapt logger macroses
Diffstat (limited to 'src/components/utils/src/lock_posix.cc')
-rw-r--r-- | src/components/utils/src/lock_posix.cc | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/components/utils/src/lock_posix.cc b/src/components/utils/src/lock_posix.cc index cd414495fc..ef6ad2a9aa 100644 --- a/src/components/utils/src/lock_posix.cc +++ b/src/components/utils/src/lock_posix.cc @@ -39,7 +39,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") Lock::Lock() #ifndef NDEBUG @@ -62,23 +62,21 @@ Lock::Lock(bool is_recursive) Lock::~Lock() { #ifndef NDEBUG if (lock_taken_ > 0) { - LOGGER_ERROR(logger_, "Destroying non-released mutex " << &mutex_); + SDL_ERROR("Destroying non-released mutex " << &mutex_); } #endif int32_t status = pthread_mutex_destroy(&mutex_); if (status != 0) { - LOGGER_ERROR(logger_, - "Failed to destroy mutex " << &mutex_ << ": " - << strerror(status)); + SDL_ERROR("Failed to destroy mutex " << &mutex_ << ": " + << strerror(status)); } } void Lock::Acquire() { const int32_t status = pthread_mutex_lock(&mutex_); if (status != 0) { - LOGGER_FATAL(logger_, - "Failed to acquire mutex " << &mutex_ << ": " - << strerror(status)); + SDL_FATAL("Failed to acquire mutex " << &mutex_ << ": " + << strerror(status)); DCHECK(status != 0); } else { AssertFreeAndMarkTaken(); @@ -89,9 +87,7 @@ void Lock::Release() { AssertTakenAndMarkFree(); const int32_t status = pthread_mutex_unlock(&mutex_); if (status != 0) { - LOGGER_ERROR(logger_, - "Failed to unlock mutex" << &mutex_ << ": " - << strerror(status)); + SDL_ERROR("Failed to unlock mutex" << &mutex_ << ": " << strerror(status)); } } @@ -111,14 +107,14 @@ bool Lock::Try() { #ifndef NDEBUG void Lock::AssertFreeAndMarkTaken() { if ((lock_taken_ > 0) && !is_mutex_recursive_) { - LOGGER_ERROR(logger_, "Locking already taken not recursive mutex"); + SDL_ERROR("Locking already taken not recursive mutex"); NOTREACHED(); } lock_taken_++; } void Lock::AssertTakenAndMarkFree() { if (lock_taken_ == 0) { - LOGGER_ERROR(logger_, "Unlocking a mutex that is not taken"); + SDL_ERROR("Unlocking a mutex that is not taken"); NOTREACHED(); } lock_taken_--; @@ -138,8 +134,7 @@ void Lock::Init(bool is_recursive) { pthread_mutexattr_destroy(&attr); if (status != 0) { - LOGGER_FATAL(logger_, - "Failed to initialize mutex. " << std::strerror(status)); + SDL_FATAL("Failed to initialize mutex. " << std::strerror(status)); DCHECK(status != 0); } } |