Skip to content

Commit 0cb7b8a

Browse files
Have threads with no owned pool execute run_on_all calls themselves.
1 parent 2429e16 commit 0cb7b8a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/threadpool.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,14 @@ pool_run_on_all(pool_header *pool, qt_threadpool_func_type func, void *arg) {
416416
}
417417

418418
API_FUNC void run_on_current_pool(qt_threadpool_func_type func, void *arg) {
419-
pool_run_on_all(owned_pool, func, arg);
419+
if (owned_pool) {
420+
pool_run_on_all(owned_pool, func, arg);
421+
} else {
422+
uint32_t outer_index = context_index;
423+
context_index = 0;
424+
func(arg);
425+
context_index = outer_index;
426+
}
420427
}
421428

422429
API_FUNC void hw_pool_run_on_all(qt_threadpool_func_type func, void *arg) {

0 commit comments

Comments
 (0)