Skip to content

Commit

Permalink
Use enum instead of int for job state
Browse files Browse the repository at this point in the history
  • Loading branch information
Robyt3 committed Oct 21, 2023
1 parent 09978f3 commit 9a966fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/engine/shared/jobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ IJob::IJob() :

IJob::~IJob() = default;

int IJob::Status()
IJob::EJobState IJob::Status()
{
return m_Status.load();
}
Expand Down
19 changes: 10 additions & 9 deletions src/engine/shared/jobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@ class IJob
{
friend CJobPool;

public:
enum EJobState
{
STATE_PENDING = 0,
STATE_RUNNING,
STATE_DONE
};

private:
std::shared_ptr<IJob> m_pNext;
std::atomic<EJobState> m_Status;

std::atomic<int> m_Status;
virtual void Run() = 0;

public:
IJob();
IJob(const IJob &Other) = delete;
IJob &operator=(const IJob &Other) = delete;
virtual ~IJob();
int Status();

enum
{
STATE_PENDING = 0,
STATE_RUNNING,
STATE_DONE
};
EJobState Status();
};

class CJobPool
Expand Down

0 comments on commit 9a966fa

Please sign in to comment.