pool->cur_threads--;
qemu_cond_signal(&pool->worker_stopped);
- qemu_mutex_unlock(&pool->lock);
/*
* Wake up another thread, in case we got a wakeup but decided
* to exit due to pool->cur_threads > pool->max_threads.
*/
- qemu_cond_signal(&pool->request_cond);
+ qemu_cond_signal(&pool->request_cond); // We probably need lock on &pool->lock
+ // without a lock, thread_pool_free() could destroy the condition.
+ qemu_mutex_unlock(&pool->lock);
return NULL;
}
}
QTAILQ_INSERT_TAIL(&pool->request_list, req, reqs);
qemu_mutex_unlock(&pool->lock);
- qemu_cond_signal(&pool->request_cond);
+ qemu_cond_signal(&pool->request_cond); // do we need a lock here as well?
return &req->common;
}