Skip to content

Commit

Permalink
fix more race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
fmz committed Jul 31, 2024
1 parent 464d237 commit 8a39d75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -18932,7 +18932,10 @@ void ggml_pause_threadpool(struct ggml_compute_threadpool * threadpool) {
#ifndef GGML_USE_OPENMP
GGML_ASSERT(!threadpool->disposable);
GGML_PRINT_DEBUG("Pausing threadpool\n");
ggml_mutex_lock(&threadpool->mutex);
threadpool->pause = true;
ggml_cond_broadcast(&threadpool->cond);
ggml_mutex_unlock(&threadpool->mutex);
#else
UNUSED(threadpool);
#endif
Expand Down Expand Up @@ -19403,9 +19406,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
__thread_affinity(threadpool->workers[0].cpumask);
}

threadpool->new_work = true;
if (!threadpool->poll) {
ggml_mutex_lock(&threadpool->mutex);
threadpool->new_work = true;
ggml_cond_broadcast(&threadpool->cond);
ggml_mutex_unlock(&threadpool->mutex);
}
Expand Down

0 comments on commit 8a39d75

Please sign in to comment.