Adds further ext deps as-is binaries copies from customers env.
Qt6 Migration CI / migrate (push) Canceled after 0s
Qt6 Migration CI / migrate (push) Canceled after 0s
This commit is contained in:
3700 files changed
+2132394
No files matched your search
+58
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
namespace ddkit {
|
||||
namespace base {
|
||||
|
||||
/// @brief wrapper for std::thread, including
|
||||
/// - clean synchronized start/stop/stopCommanded-mechanism
|
||||
/// - tracing with threadname, exception-logging on outermost level
|
||||
class Thread {
|
||||
|
||||
public:
|
||||
/// @param name 6-char-thread-name
|
||||
Thread(const std::string& name);
|
||||
virtual ~Thread();
|
||||
|
||||
void start();
|
||||
// void stop(); // call stopAndJoin instead
|
||||
void stopAndJoin();
|
||||
|
||||
bool isActive() const;
|
||||
void waitForStopCommanded();
|
||||
bool stopCommanded() const;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
std::unique_ptr<std::thread> m_thread;
|
||||
bool m_threadExecutionActive;
|
||||
|
||||
std::mutex m_mutexStart;
|
||||
std::condition_variable m_threadStarted;
|
||||
bool m_hasStarted;
|
||||
|
||||
std::mutex m_mutexStop;
|
||||
std::condition_variable m_threadStopped;
|
||||
bool m_stopCommanded;
|
||||
|
||||
virtual void run();
|
||||
virtual void onStop();
|
||||
|
||||
void startUp();
|
||||
|
||||
void waitForStarted();
|
||||
virtual void waitForReadyIf();
|
||||
|
||||
// no copying
|
||||
Thread(Thread const&) = delete;
|
||||
Thread(Thread&&) = delete;
|
||||
void operator=(Thread const&) = delete;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
} // namespace ddkit
|
||||
Reference in new issue
Block a user