22 #include "common/make_unique.h"
24 #include "common/thread/sdl_cond_wrapper.h"
25 #include "common/thread/sdl_mutex_wrapper.h"
26 #include "common/thread/thread.h"
39 using ThreadFunctionPtr = std::function<void()>;
43 : m_thread(std::bind(&CWorkerThread::Run,
this), name)
57 void Start(ThreadFunctionPtr func)
74 while (m_queue.empty() && m_running)
76 m_cond.Wait(*m_mutex);
78 if (!m_running)
break;
80 ThreadFunctionPtr func = m_queue.front();
90 bool m_running =
true;
91 std::queue<ThreadFunctionPtr> m_queue;
Wrapper for safe creation/deletion of SDL_cond.
Definition: sdl_cond_wrapper.h:30
Wrapper for safe creation/deletion of SDL_mutex.
Definition: sdl_mutex_wrapper.h:28
Wrapper for using SDL_thread with std::function.
Definition: thread.h:34
Thread that runs functions, one at a time.
Definition: worker_thread.h:36