Skip to content

Commit 0bb4bca

Browse files
fmzfmz
authored and
fmz
committed
fix more race conditions
1 parent 0a01fd3 commit 0bb4bca

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
@@ -18953,7 +18953,10 @@ void ggml_pause_threadpool(struct ggml_compute_threadpool * threadpool) {
1895318953
#ifndef GGML_USE_OPENMP
1895418954
GGML_ASSERT(!threadpool->disposable);
1895518955
GGML_PRINT_DEBUG("Pausing threadpool\n");
18956+
ggml_mutex_lock(&threadpool->mutex);
1895618957
threadpool->pause = true;
18958+
ggml_cond_broadcast(&threadpool->cond);
18959+
ggml_mutex_unlock(&threadpool->mutex);
1895718960
#else
1895818961
UNUSED(threadpool);
1895918962
#endif
@@ -19424,9 +19427,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
1942419427
__thread_affinity(threadpool->workers[0].cpumask);
1942519428
}
1942619429

19427-
threadpool->new_work = true;
1942819430
if (!threadpool->poll) {
1942919431
ggml_mutex_lock(&threadpool->mutex);
19432+
threadpool->new_work = true;
1943019433
ggml_cond_broadcast(&threadpool->cond);
1943119434
ggml_mutex_unlock(&threadpool->mutex);
1943219435
}

0 commit comments

Comments
 (0)