Skip to content

Commit a5c9dee

Browse files
swolchokfacebook-github-bot
authored andcommitted
Fix non-reentrant threadpool (#5714)
Summary: Pull Request resolved: #5714 If we tried to reenter parallel_for, we would deadlock due to trying to acquire the threadpool mutex, which was already held. Removing the mutex (which is unnecessary) didn't fix the problem because pthreadpool has its own internal mutex. Reviewed By: kimishpatel Differential Revision: D62052200 fbshipit-source-id: 1be16d581970fa7b6a84a2f5b4e348b4f5069c80
1 parent bd03d6b commit a5c9dee

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

extension/threadpool/threadpool.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void ThreadPool::run(
8686
// pthreadpool_parallelize_1d() cannot go out of scope until
8787
// pthreadpool_parallelize_1d() returns.
8888
[](void* const context, const size_t item) {
89+
NoThreadPoolGuard guard;
8990
reinterpret_cast<Context*>(context)->fn(item);
9091
},
9192
&context,

0 commit comments

Comments
 (0)