Skip to content

Commit a7f4a5e

Browse files
committed
fix more race conditions
1 parent 3b45d50 commit a7f4a5e

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
@@ -18891,7 +18891,10 @@ void ggml_pause_threadpool(struct ggml_compute_threadpool * threadpool) {
1889118891
#ifndef GGML_USE_OPENMP
1889218892
GGML_ASSERT(!threadpool->disposable);
1889318893
GGML_PRINT_DEBUG("Pausing threadpool\n");
18894+
ggml_mutex_lock(&threadpool->mutex);
1889418895
threadpool->pause = true;
18896+
ggml_cond_broadcast(&threadpool->cond);
18897+
ggml_mutex_unlock(&threadpool->mutex);
1889518898
#else
1889618899
UNUSED(threadpool);
1889718900
#endif
@@ -19362,9 +19365,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
1936219365
__thread_affinity(threadpool->workers[0].cpumask);
1936319366
}
1936419367

19365-
threadpool->new_work = true;
1936619368
if (!threadpool->poll) {
1936719369
ggml_mutex_lock(&threadpool->mutex);
19370+
threadpool->new_work = true;
1936819371
ggml_cond_broadcast(&threadpool->cond);
1936919372
ggml_mutex_unlock(&threadpool->mutex);
1937019373
}

0 commit comments

Comments
 (0)