56 explicit operator bool()
const {
return m_thread !=
nullptr; }
61 std::unique_lock<wpi::util::mutex>
m_lock;
101 explicit operator bool()
const;
108 void Start(std::shared_ptr<SafeThreadBase> thr);
113 std::thread m_stdThread;
114 std::weak_ptr<SafeThreadBase> m_thread;
115 std::atomic_bool m_joinAtExit{
true};
125 template <
typename... Args>
128 std::make_shared<T>(std::forward<Args>(args)...));
137 return std::static_pointer_cast<T>(
An atomic signaling event for synchronization.
Definition Synchronization.hpp:231
Base class for SafeThreadOwner threads.
Definition SafeThread.hpp:21
std::thread::id m_threadId
Definition SafeThread.hpp:29
wpi::util::mutex m_mutex
Definition SafeThread.hpp:27
virtual ~SafeThreadBase()=default
std::atomic_bool m_active
Definition SafeThread.hpp:28
Event m_stopEvent
Definition SafeThread.hpp:45
SafeThreadEvent()
Definition SafeThread.hpp:41
Definition SafeThread.hpp:32
wpi::util::condition_variable m_cond
Definition SafeThread.hpp:36
Definition SafeThread.hpp:123
void Start(Args &&... args)
Definition SafeThread.hpp:126
typename detail::SafeThreadProxy< T > Proxy
Definition SafeThread.hpp:131
Proxy GetThread() const
Definition SafeThread.hpp:132
std::shared_ptr< T > GetThreadSharedPtr() const
Definition SafeThread.hpp:136
Non-template owner base class for common owner code.
Definition SafeThread.hpp:81
SafeThreadOwnerBase() noexcept=default
void SetJoinAtExit(bool joinAtExit)
Definition SafeThread.hpp:105
std::thread::native_handle_type GetNativeThreadHandle()
friend void swap(SafeThreadOwnerBase &lhs, SafeThreadOwnerBase &rhs) noexcept
void Start(std::shared_ptr< SafeThreadBase > thr)
SafeThreadOwnerBase & operator=(SafeThreadOwnerBase &&other) noexcept
Definition SafeThread.hpp:93
std::shared_ptr< SafeThreadBase > GetThreadSharedPtr() const
std::shared_ptr< SafeThreadBase > m_thread
Definition SafeThread.hpp:60
std::unique_lock< wpi::util::mutex > m_lock
Definition SafeThread.hpp:61
std::unique_lock< wpi::util::mutex > & GetLock()
Definition SafeThread.hpp:57
SafeThreadProxyBase(std::shared_ptr< SafeThreadBase > thr)
A proxy for SafeThread.
Definition SafeThread.hpp:70
SafeThreadProxy(std::shared_ptr< SafeThreadBase > thr)
Definition SafeThread.hpp:72
T & operator*() const
Definition SafeThread.hpp:74
T * operator->() const
Definition SafeThread.hpp:75
Converts a string literal into a format string that will be parsed at compile time and converted into...
Definition printf.h:50
Definition StringMap.hpp:773
void swap(SafeThreadOwnerBase &lhs, SafeThreadOwnerBase &rhs) noexcept
Definition raw_os_ostream.hpp:19
::std::condition_variable condition_variable
Definition condition_variable.hpp:16
::std::mutex mutex
Definition mutex.hpp:17