diff options
Diffstat (limited to 'src/components/utils/include')
12 files changed, 52 insertions, 56 deletions
diff --git a/src/components/utils/include/utils/back_trace.h b/src/components/utils/include/utils/back_trace.h index f2410e36bc..7f8912faf9 100644 --- a/src/components/utils/include/utils/back_trace.h +++ b/src/components/utils/include/utils/back_trace.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -61,10 +61,10 @@ class Backtrace { // Captured symbols in order from topmost stack frame to last captured std::vector<std::string> CallStack() const; - threads::PlatformThreadHandle ThreadId() const; + threads::Thread::Id ThreadId() const; private: - threads::PlatformThreadHandle thread_id_; + threads::Thread::Id thread_id_; std::vector<void*> backtrace_; }; diff --git a/src/components/utils/include/utils/bitstream.h b/src/components/utils/include/utils/bitstream.h index 9bf41d187f..cba15abd8b 100644 --- a/src/components/utils/include/utils/bitstream.h +++ b/src/components/utils/include/utils/bitstream.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2013, Ford Motor Company * All rights reserved. * diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h index 4340158467..d68ec484f9 100644 --- a/src/components/utils/include/utils/file_system.h +++ b/src/components/utils/include/utils/file_system.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2013, Ford Motor Company * All rights reserved. * diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/log_message_loop_thread.h index 87b6c7e531..b23a246e13 100644 --- a/src/components/utils/include/utils/log_message_loop_thread.h +++ b/src/components/utils/include/utils/log_message_loop_thread.h @@ -37,7 +37,6 @@ #include <queue> #include <log4cxx/logger.h> -#include "utils/macro.h" #include "utils/threads/message_loop_thread.h" #include "utils/singleton.h" diff --git a/src/components/utils/include/utils/resource_usage.h b/src/components/utils/include/utils/resource_usage.h index 1f1a58b47c..a8fa4aa7d9 100644 --- a/src/components/utils/include/utils/resource_usage.h +++ b/src/components/utils/include/utils/resource_usage.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2014, Ford Motor Company * All rights reserved. * diff --git a/src/components/utils/include/utils/signals.h b/src/components/utils/include/utils/signals.h index 6c91836309..28e8afd9d6 100644 --- a/src/components/utils/include/utils/signals.h +++ b/src/components/utils/include/utils/signals.h @@ -1,49 +1,41 @@ /* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +* Copyright (c) 2014, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ #ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SIGNALS_H_ #define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SIGNALS_H_ -#ifdef __QNXNTO__ -typedef void (*sighandler_t) (int); -#else -#include <signal.h> -#endif - namespace utils { - -bool SubscribeToTerminateSignal(sighandler_t func); -bool SubscribeToFaultSignal(sighandler_t func); - +bool SubscribeToTerminateSignal(void (*func)(int32_t p)); +bool ResetSubscribeToTerminateSignal(); } // namespace utils #endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SIGNALS_H_ diff --git a/src/components/utils/include/utils/singleton.h b/src/components/utils/include/utils/singleton.h index 41face4f2f..d7b625e0a1 100644 --- a/src/components/utils/include/utils/singleton.h +++ b/src/components/utils/include/utils/singleton.h @@ -28,7 +28,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */ +*/ #ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SINGLETON_H_ #define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SINGLETON_H_ diff --git a/src/components/utils/include/utils/stl_utils.h b/src/components/utils/include/utils/stl_utils.h index afab995857..f525c6429f 100644 --- a/src/components/utils/include/utils/stl_utils.h +++ b/src/components/utils/include/utils/stl_utils.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2013, Ford Motor Company * All rights reserved. * diff --git a/src/components/utils/include/utils/system.h b/src/components/utils/include/utils/system.h index f04a5780ca..16bdc03673 100644 --- a/src/components/utils/include/utils/system.h +++ b/src/components/utils/include/utils/system.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2014, Ford Motor Company * All rights reserved. * diff --git a/src/components/utils/include/utils/threads/pulse_thread_delegate.h b/src/components/utils/include/utils/threads/pulse_thread_delegate.h index 207b64caaf..bb109bde94 100644 --- a/src/components/utils/include/utils/threads/pulse_thread_delegate.h +++ b/src/components/utils/include/utils/threads/pulse_thread_delegate.h @@ -57,7 +57,7 @@ class PulseThreadDelegate : public ThreadDelegate { */ PulseThreadDelegate(); virtual void threadMain(); - virtual void exitThreadMain(); + virtual bool exitThreadMain(); protected: /** @@ -86,7 +86,7 @@ class PulseThreadDelegate : public ThreadDelegate { private: enum {PULSE_CODE = _PULSE_CODE_MINAVAIL + 1}; - volatile bool run_; + bool run_; int chid_; int coid_; }; diff --git a/src/components/utils/include/utils/threads/thread_manager.h b/src/components/utils/include/utils/threads/thread_manager.h index 38fecb58a2..d72abb428f 100644 --- a/src/components/utils/include/utils/threads/thread_manager.h +++ b/src/components/utils/include/utils/threads/thread_manager.h @@ -63,7 +63,12 @@ namespace threads { */ class ThreadManager : public utils::Singleton<ThreadManager> { public: + struct ThreadDesc { + pthread_t handle; + ThreadDelegate* delegate; + }; ThreadManager() {} + MessageQueue<ThreadDesc> threads_to_terminate; private: DISALLOW_COPY_AND_ASSIGN(ThreadManager); diff --git a/src/components/utils/include/utils/threads/thread_validator.h b/src/components/utils/include/utils/threads/thread_validator.h index 214b96c3e5..def1994b76 100644 --- a/src/components/utils/include/utils/threads/thread_validator.h +++ b/src/components/utils/include/utils/threads/thread_validator.h @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -68,7 +68,7 @@ class SingleThreadSimpleValidator { // of classes being checked for absence of concurrent access void AssertRunningOnCreationThread() const; private: - const PlatformThreadHandle creation_thread_id_; + const Thread::Id creation_thread_id_; }; @@ -91,13 +91,13 @@ class SingleThreadValidator { // Must be called prior to transferring object being validated to // another thread or when passing it back - void PassToThread(PlatformThreadHandle thread_id) const; + void PassToThread(Thread::Id thread_id) const; // This method should be called in every public method // of classes being checked for absence of unintended concurrent // access void AssertRunningOnValidThread() const; private: - mutable PlatformThreadHandle owning_thread_id_; + mutable Thread::Id owning_thread_id_; }; } // namespace threads |