fix segfault: parallel_do tries to acquire numThreads-1 threads. And there are cases it wanted to get 0 threads. And it was falsely returning back valid ticket because of missing conditions. Here how it was happening in real run: There are functions where nested threading can happen. So in segfault case (example:gather op) outer threading acquired all threads. and as inner functions tried to acquire threads themselves. And as the inner function was using faulty parallel_do it seg faulted.
Signed-off-by: AbdelRauf <rauf@konduit.ai>master
parent
c5c5d3ef4c
commit
10b52e77b0
|
@ -151,7 +151,7 @@ namespace samediff {
|
||||||
|
|
||||||
Ticket* ThreadPool::tryAcquire(int numThreads) {
|
Ticket* ThreadPool::tryAcquire(int numThreads) {
|
||||||
//std::vector<BlockingQueue<CallableWithArguments*>*> queues;
|
//std::vector<BlockingQueue<CallableWithArguments*>*> queues;
|
||||||
|
if(numThreads<=0) return nullptr;
|
||||||
Ticket *t = nullptr;
|
Ticket *t = nullptr;
|
||||||
// we check for threads availability first
|
// we check for threads availability first
|
||||||
bool threaded = false;
|
bool threaded = false;
|
||||||
|
|
Loading…
Reference in New Issue