mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 12:47:12 +01:00
Now ThreadPool should properly handle when use_threads changes.
This commit is contained in:
parent
b6624bf30b
commit
7dd2bce61b
@ -40,7 +40,8 @@ bool ThreadPool::get_use_threads() const {
|
|||||||
return _use_threads;
|
return _use_threads;
|
||||||
}
|
}
|
||||||
void ThreadPool::set_use_threads(const bool value) {
|
void ThreadPool::set_use_threads(const bool value) {
|
||||||
_use_threads = value;
|
// Will be applied later in update, so current jobs can be finished first
|
||||||
|
_use_threads_new = value;
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +296,8 @@ void ThreadPool::register_core_settings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_use_threads_new = _use_threads;
|
||||||
|
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
|
|
||||||
apply_settings();
|
apply_settings();
|
||||||
@ -329,6 +332,8 @@ void ThreadPool::apply_settings() {
|
|||||||
|
|
||||||
_threads.resize(0);
|
_threads.resize(0);
|
||||||
|
|
||||||
|
_use_threads = _use_threads_new;
|
||||||
|
|
||||||
if (_use_threads) {
|
if (_use_threads) {
|
||||||
_threads.resize(_thread_count);
|
_threads.resize(_thread_count);
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ private:
|
|||||||
|
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
bool _use_threads;
|
bool _use_threads;
|
||||||
|
bool _use_threads_new;
|
||||||
int _thread_count;
|
int _thread_count;
|
||||||
int _thread_fallback_count;
|
int _thread_fallback_count;
|
||||||
float _max_work_per_frame_percent;
|
float _max_work_per_frame_percent;
|
||||||
|
Loading…
Reference in New Issue
Block a user