summaryrefslogtreecommitdiff
path: root/Runtime/Threading/JobSystem.h
blob: 7f8148a836c3c7ded197b93e75226c556248f7be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include "Runtime/Utilities/Singleton.h"
#include "Runtime/Threading/Thread.h"
#include <vector>

class JobSystem : public Singleton<JobSystem>
{
public:
	JobSystem();
	~JobSystem();

	void AddJobAtEnd(Job* job);

	void Initilize(int workThreadCount = 1);
	void Dispatch(void* param);

private:
	WorkThread* SelectThread();

	bool m_Initialized;
	std::vector<WorkThread*> m_Threads;
	int m_Cur;
	int m_ThreadCount;

};