Skip to content

Commit 0390df2

Browse files
committed
fix more race conditions
1 parent 62ef260 commit 0390df2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ggml/src/ggml.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18889,7 +18889,10 @@ void ggml_pause_threadpool(struct ggml_compute_threadpool * threadpool) {
1888918889
#ifndef GGML_USE_OPENMP
1889018890
GGML_ASSERT(!threadpool->disposable);
1889118891
GGML_PRINT_DEBUG("Pausing threadpool\n");
18892+
ggml_mutex_lock(&threadpool->mutex);
1889218893
threadpool->pause = true;
18894+
ggml_cond_broadcast(&threadpool->cond);
18895+
ggml_mutex_unlock(&threadpool->mutex);
1889318896
#else
1889418897
UNUSED(threadpool);
1889518898
#endif
@@ -19360,9 +19363,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
1936019363
__thread_affinity(threadpool->workers[0].cpumask);
1936119364
}
1936219365

19363-
threadpool->new_work = true;
1936419366
if (!threadpool->poll) {
1936519367
ggml_mutex_lock(&threadpool->mutex);
19368+
threadpool->new_work = true;
1936619369
ggml_cond_broadcast(&threadpool->cond);
1936719370
ggml_mutex_unlock(&threadpool->mutex);
1936819371
}

0 commit comments

Comments
 (0)