HatchitGraphics
ht_renderthread.h
1 
23 #pragma once
24 
25 #include <ht_platform.h> //HT_API
26 #include <ht_threadqueue.h> //Threadsafe Queue
27 #include <ht_renderpass.h> //RenderPassHandle
28 #include <atomic> //Atomics
29 #include <thread> //Threads
30 
31 namespace Hatchit
32 {
33  namespace Graphics
34  {
35  class HT_API RenderThread
36  {
37  public:
38  virtual ~RenderThread() {};
39 
40  virtual void VStart(std::condition_variable* notifyLock, Core::ThreadsafeQueue<RenderPassHandle>* jobQueue) = 0;
41 
42  void Kill();
43  void Notify();
44 
45  const bool Processed() const;
46 
47  protected:
48  std::thread m_thread;
49  std::mutex m_mutex;
50  std::condition_variable m_waitLock; //We wait on this lock before processing
51  std::condition_variable* m_notifyLock; //This is given by the main thread; it's how we notify it that we're done
52  std::atomic_bool m_alive;
53  std::atomic_bool m_processing;
54 
55  Core::ThreadsafeQueue<RenderPassHandle>* m_jobQueue;
56  };
57  }
58 }
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_color.h:19
Definition: ht_renderthread.h:35