Index

zydeco / fractal

Experiment in graphics programming, C++, OpenGL, simulation techniques.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
631 Aug 2023 21:183195a10Update program flowJosh Stockin1380G

Blob @ zydeco / include / runtime / ThreadLooping.hpp

text/plain680 bytesdownload raw
1#ifndef THREAD_LOOPING_HPP_
2#define THREAD_LOOPING_HPP_
3
4
5#include <thread>
6#include <atomic>
7#include <string>
8
9#include "IThread.hpp"
10
11
12class IUpdateable;
13
14
15class ThreadLooping : IThread
16{
17public:
18 ThreadLooping(std::string thread_name, IUpdateable& thread_update);
19 ~ThreadLooping();
20
21 void Start() override;
22 void Terminate() override;
23
24 bool IsRunning() override;
25 void WaitUntilFinished() override;
26
27protected:
28 void ThreadRunLoop();
29
30 IUpdateable& m_rThreadUpdate;
31 std::string m_threadName;
32 std::thread m_thread;
33 std::atomic<bool> m_aShouldThreadTerminate;
34 std::atomic<bool> m_aIsThreadRunning;
35};
36
37
38#endif /* THREAD_LOOPING_HPP_ */
39