Remove limit execution time bool, as it's trivial to check for the same thing.

This commit is contained in:
Relintai 2020-08-04 10:45:32 +02:00
parent 262cdb6638
commit db1d5d1d81
2 changed files with 2 additions and 10 deletions

View File

@ -110,7 +110,7 @@ bool ThreadPoolJob::should_return() {
if (_cancelled)
return true;
if (!_limit_execution_time)
if (_max_allocated_time < 0.00001)
return false;
return get_current_execution_time() >= _max_allocated_time;
@ -132,7 +132,6 @@ ThreadPoolJob::ThreadPoolJob() {
_complete = true;
_cancelled = false;
_limit_execution_time = false;
_max_allocated_time = 0;
_start_time = 0;
@ -154,10 +153,6 @@ void ThreadPoolJob::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_complete", "value"), &ThreadPoolJob::set_complete);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "complete"), "set_complete", "get_complete");
ClassDB::bind_method(D_METHOD("get_limit_execution_time"), &ThreadPoolJob::get_limit_execution_time);
ClassDB::bind_method(D_METHOD("set_limit_execution_time", "value"), &ThreadPoolJob::set_limit_execution_time);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "limit_execution_time"), "set_limit_execution_time", "get_limit_execution_time");
ClassDB::bind_method(D_METHOD("get_start_time"), &ThreadPoolJob::get_start_time);
ClassDB::bind_method(D_METHOD("set_start_time", "value"), &ThreadPoolJob::set_start_time);
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_time"), "set_start_time", "get_start_time");

View File

@ -32,6 +32,7 @@ class ThreadPoolJob : public Reference {
public:
//is_running, is queued?
//job status -> none, running, queued?
bool get_complete() const;
void set_complete(const bool value);
@ -39,9 +40,6 @@ public:
bool get_cancelled() const;
void set_cancelled(const bool value);
bool get_limit_execution_time() const;
void set_limit_execution_time(const bool value);
float get_max_allocated_time() const;
void set_max_allocated_time(const float value);
@ -77,7 +75,6 @@ private:
bool _complete;
bool _cancelled;
bool _limit_execution_time;
float _max_allocated_time;
uint64_t _start_time;