mirror of https://github.com/Xaymar/obs-StreamFX
util/threadpool: Initialize worker count to 0
Many platforms (and/or kernels) don't zero memory before it is acquired, resulting in uninitialized memory being used to store critical content. This made the threadpool assume it had an infinite number of threads to work with, despite actually having spawned none. Fixes #1017
This commit is contained in:
parent
980c15efa6
commit
20e1a94eba
|
@ -1,4 +1,5 @@
|
|||
// Copyright (C) 2020-2022 Michael Fabian Dirks
|
||||
// Copyright (C) 2023 tt2468
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -133,7 +134,7 @@ streamfx::util::threadpool::threadpool::~threadpool()
|
|||
}
|
||||
|
||||
streamfx::util::threadpool::threadpool::threadpool(size_t minimum, size_t maximum)
|
||||
: _limits{minimum, maximum}, _workers_lock(), _workers(), _tasks_lock(), _tasks_cv(), _tasks()
|
||||
: _limits{minimum, maximum}, _workers_lock(), _worker_count(0), _workers(), _tasks_lock(), _tasks_cv(), _tasks()
|
||||
{
|
||||
// Spawn the minimum number of threads.
|
||||
spawn(_limits.first);
|
||||
|
|
Loading…
Reference in New Issue