summaryrefslogtreecommitdiff
path: root/src/components/utils/src/threads/thread_validator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/utils/src/threads/thread_validator.cc')
-rw-r--r--src/components/utils/src/threads/thread_validator.cc44
1 files changed, 18 insertions, 26 deletions
diff --git a/src/components/utils/src/threads/thread_validator.cc b/src/components/utils/src/threads/thread_validator.cc
index 99b812c456..4024522ae4 100644
--- a/src/components/utils/src/threads/thread_validator.cc
+++ b/src/components/utils/src/threads/thread_validator.cc
@@ -39,39 +39,32 @@ namespace threads {
CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
SingleThreadSimpleValidator::SingleThreadSimpleValidator()
- : creation_thread_id_(Thread::CurrentId()) {
-}
+ : creation_thread_id_(Thread::CurrentId()) {}
-SingleThreadSimpleValidator::~SingleThreadSimpleValidator() {
-}
+SingleThreadSimpleValidator::~SingleThreadSimpleValidator() {}
void SingleThreadSimpleValidator::AssertRunningOnCreationThread() const {
PlatformThreadHandle current_id = Thread::CurrentId();
if (creation_thread_id_ != current_id) {
- LOG4CXX_ERROR(logger_, "Single-threaded object created at thread "
- << creation_thread_id_
- <<" is accessed from thread "
- << current_id
+ LOG4CXX_ERROR(logger_,
+ "Single-threaded object created at thread "
+ << creation_thread_id_ << " is accessed from thread "
+ << current_id
#ifdef BACKTRACE_SUPPORT
- << "\n"
- << utils::Backtrace()
+ << "\n" << utils::Backtrace()
#endif
- );
+ );
}
}
-PlatformThreadHandle SingleThreadSimpleValidator::creation_thread_id() const
-{
+PlatformThreadHandle SingleThreadSimpleValidator::creation_thread_id() const {
return creation_thread_id_;
}
-
SingleThreadValidator::SingleThreadValidator()
- : owning_thread_id_(Thread::CurrentId()){
-}
+ : owning_thread_id_(Thread::CurrentId()) {}
-SingleThreadValidator::~SingleThreadValidator() {
-}
+SingleThreadValidator::~SingleThreadValidator() {}
void SingleThreadValidator::PassToThread(PlatformThreadHandle thread_id) const {
owning_thread_id_ = thread_id;
@@ -80,18 +73,17 @@ void SingleThreadValidator::PassToThread(PlatformThreadHandle thread_id) const {
void SingleThreadValidator::AssertRunningOnValidThread() const {
PlatformThreadHandle current_id = Thread::CurrentId();
if (owning_thread_id_ != current_id) {
- LOG4CXX_ERROR(logger_, "Single-threaded object owned by thread "
- << owning_thread_id_
- << " is accessed from thread "
- << current_id << "\n"
+ LOG4CXX_ERROR(logger_,
+ "Single-threaded object owned by thread "
+ << owning_thread_id_ << " is accessed from thread "
+ << current_id << "\n"
#ifdef BACKTRACE_SUPPORT
- << utils::Backtrace()
+ << utils::Backtrace()
#endif
- );
+ );
}
}
-
-} // namespace threads
+} // namespace threads
// vim: set ts=2 sw=2 et: