mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-02 22:35:55 +01:00
Fix race condition.
This commit is contained in:
parent
48d26e9400
commit
099b05380e
@ -113,16 +113,17 @@ bool ThreadPool::is_working_no_lock() const {
|
||||
}
|
||||
|
||||
bool ThreadPool::has_job(const Ref<ThreadPoolJob> &job) {
|
||||
_THREAD_SAFE_LOCK_
|
||||
|
||||
for (int i = 0; i < _threads.size(); ++i) {
|
||||
ThreadPoolContext *context = _threads.get(i);
|
||||
|
||||
if (context->job == job) {
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
_THREAD_SAFE_LOCK_
|
||||
|
||||
List<Ref<ThreadPoolJob>>::Element *E = _queue.find(job);
|
||||
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
|
Loading…
Reference in New Issue
Block a user