mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
41 lines
641 B
C++
41 lines
641 B
C++
|
#include "stdafx.h"
|
||
|
#include "Job.h"
|
||
|
|
||
|
namespace Jobs
|
||
|
{
|
||
|
Job::Job()
|
||
|
: Job(nullptr, nullptr, true)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
Job::Job(std::function<void()> Task, std::function<void()> OnFinished, bool IsAwaiter)
|
||
|
: _Task(std::move(Task)), _Finished(std::move(OnFinished)), _IsFinished(false), _IsAwaiter(IsAwaiter)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void Job::Execute()
|
||
|
{
|
||
|
if (_Task != nullptr)
|
||
|
_Task();
|
||
|
if (_Finished != nullptr)
|
||
|
_Finished();
|
||
|
|
||
|
this->_IsFinished = true;
|
||
|
}
|
||
|
|
||
|
void Job::SetIsFinished()
|
||
|
{
|
||
|
this->_IsFinished = true;
|
||
|
}
|
||
|
|
||
|
bool Job::IsFinished()
|
||
|
{
|
||
|
return (this->_IsFinished == true);
|
||
|
}
|
||
|
|
||
|
bool Job::IsAwaiter()
|
||
|
{
|
||
|
return (this->_IsAwaiter == true);
|
||
|
}
|
||
|
}
|