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
AbdelRauf 2021-03-01 13:38:43 +01:00
parent c5c5d3ef4c
commit 10b52e77b0
1 changed files with 1 additions and 1 deletions

View File

@ -151,7 +151,7 @@ namespace samediff {
Ticket* ThreadPool::tryAcquire(int numThreads) {
//std::vector<BlockingQueue<CallableWithArguments*>*> queues;
if(numThreads<=0) return nullptr;
Ticket *t = nullptr;
// we check for threads availability first
bool threaded = false;