diff options
author | Conlain Kelly <conlain.k@gmail.com> | 2018-06-11 15:13:46 -0400 |
---|---|---|
committer | Conlain Kelly <conlain.k@gmail.com> | 2018-06-11 15:13:46 -0400 |
commit | 951b298329e23b8b8e0948bd522f35c36b64ea57 (patch) | |
tree | 54a84cd0983605e420fbd4f00a119fae77cfd14c /src/components/utils/src/lock_posix.cc | |
parent | 51c427ee43c42bf72d65b5f964cdbdd00ae1de4d (diff) | |
download | sdl_core-951b298329e23b8b8e0948bd522f35c36b64ea57.tar.gz |
Convert DataAccessor to use a shared_ptr to a lock
Diffstat (limited to 'src/components/utils/src/lock_posix.cc')
-rw-r--r-- | src/components/utils/src/lock_posix.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/utils/src/lock_posix.cc b/src/components/utils/src/lock_posix.cc index 9b90ad20b9..b771a57726 100644 --- a/src/components/utils/src/lock_posix.cc +++ b/src/components/utils/src/lock_posix.cc @@ -37,6 +37,8 @@ #include <string.h> #include <cstring> #include "utils/logger.h" +#include <iostream> +#include <signal.h> namespace sync_primitives { @@ -63,6 +65,8 @@ Lock::Lock(bool is_recursive) Lock::~Lock() { #ifndef NDEBUG if (lock_taken_ > 0) { + std::cerr << "LOCK DESTRUCT ERRROR!!!\n"; + exit(1); LOG4CXX_ERROR(logger_, "Destroying non-released mutex " << &mutex_); } #endif @@ -77,6 +81,8 @@ Lock::~Lock() { void Lock::Acquire() { const int32_t status = pthread_mutex_lock(&mutex_); if (status != 0) { + std::cerr << "LOCK ACQUIRE ERRROR!!!\n"; + exit(1); LOG4CXX_FATAL(logger_, "Failed to acquire mutex " << &mutex_ << ": " << strerror(status)); @@ -90,6 +96,8 @@ void Lock::Release() { AssertTakenAndMarkFree(); const int32_t status = pthread_mutex_unlock(&mutex_); if (status != 0) { + std::cerr << "LOCK RELEASE ERRROR!!!\n"; + exit(1); LOG4CXX_ERROR(logger_, "Failed to unlock mutex" << &mutex_ << ": " << strerror(status)); |