mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 04:46:48 +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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@ -295,6 +296,8 @@ void ThreadPool::register_core_settings() {
|
||||
}
|
||||
}
|
||||
|
||||
_use_threads_new = _use_threads;
|
||||
|
||||
_dirty = true;
|
||||
|
||||
apply_settings();
|
||||
@ -329,6 +332,8 @@ void ThreadPool::apply_settings() {
|
||||
|
||||
_threads.resize(0);
|
||||
|
||||
_use_threads = _use_threads_new;
|
||||
|
||||
if (_use_threads) {
|
||||
_threads.resize(_thread_count);
|
||||
|
||||
|
@ -101,6 +101,7 @@ private:
|
||||
|
||||
bool _dirty;
|
||||
bool _use_threads;
|
||||
bool _use_threads_new;
|
||||
int _thread_count;
|
||||
int _thread_fallback_count;
|
||||
float _max_work_per_frame_percent;
|
||||
|
Loading…
Reference in New Issue
Block a user