diff options
Diffstat (limited to 'Runtime/Threading/JobSystem.cpp')
-rw-r--r-- | Runtime/Threading/JobSystem.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Runtime/Threading/JobSystem.cpp b/Runtime/Threading/JobSystem.cpp new file mode 100644 index 0000000..a026300 --- /dev/null +++ b/Runtime/Threading/JobSystem.cpp @@ -0,0 +1,43 @@ +#include "JobSystem.h" + +JobSystem::JobSystem() +{ + +} + +JobSystem::~JobSystem() +{ + +} + +void JobSystem::Initilize(int workThreadCount) +{ + if (workThreadCount <= 0) + return; + + for (int i = 0; i < workThreadCount; ++i) + { + WorkThread* thread = new WorkThread(); + thread->Resume(); + m_Threads.push_back(thread); + } +} + +void JobSystem::Dispatch(void* param) +{ + for (int i = 0; i < m_Threads.size(); ++i) + { + m_Threads[i]->Dispatch(param); + } +} + +void JobSystem::AddJobAtEnd(Job* job) +{ + WorkThread* thread = SelectThread(); + thread->AddJobAtEnd(job); +} + +WorkThread* JobSystem::SelectThread() +{ + return m_Threads[0]; +}
\ No newline at end of file |