Skip to content

Commit 8a39d75

Browse files
committed
fix more race conditions
1 parent 464d237 commit 8a39d75

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
@@ -18932,7 +18932,10 @@ void ggml_pause_threadpool(struct ggml_compute_threadpool * threadpool) {
1893218932
#ifndef GGML_USE_OPENMP
1893318933
GGML_ASSERT(!threadpool->disposable);
1893418934
GGML_PRINT_DEBUG("Pausing threadpool\n");
18935+
ggml_mutex_lock(&threadpool->mutex);
1893518936
threadpool->pause = true;
18937+
ggml_cond_broadcast(&threadpool->cond);
18938+
ggml_mutex_unlock(&threadpool->mutex);
1893618939
#else
1893718940
UNUSED(threadpool);
1893818941
#endif
@@ -19403,9 +19406,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
1940319406
__thread_affinity(threadpool->workers[0].cpumask);
1940419407
}
1940519408

19406-
threadpool->new_work = true;
1940719409
if (!threadpool->poll) {
1940819410
ggml_mutex_lock(&threadpool->mutex);
19411+
threadpool->new_work = true;
1940919412
ggml_cond_broadcast(&threadpool->cond);
1941019413
ggml_mutex_unlock(&threadpool->mutex);
1941119414
}

0 commit comments

Comments
 (0)