File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -18967,8 +18967,10 @@ void ggml_pause_threadpool(struct ggml_compute_threadpool * threadpool) {
18967
18967
GGML_ASSERT(!threadpool->disposable);
18968
18968
GGML_PRINT_DEBUG("Pausing threadpool\n");
18969
18969
ggml_mutex_lock(&threadpool->mutex);
18970
- threadpool->pause = true;
18971
- ggml_cond_broadcast(&threadpool->cond);
18970
+ if (!threadpool->pause) {
18971
+ threadpool->pause = true;
18972
+ ggml_cond_broadcast(&threadpool->cond);
18973
+ }
18972
18974
ggml_mutex_unlock(&threadpool->mutex);
18973
18975
#else
18974
18976
UNUSED(threadpool);
@@ -18981,8 +18983,10 @@ void ggml_resume_threadpool(struct ggml_compute_threadpool * threadpool) {
18981
18983
GGML_PRINT_DEBUG("Resuming threadpool\n");
18982
18984
18983
18985
ggml_mutex_lock(&threadpool->mutex);
18984
- threadpool->pause = false;
18985
- ggml_cond_broadcast(&threadpool->cond);
18986
+ if (threadpool->pause) {
18987
+ threadpool->pause = false;
18988
+ ggml_cond_broadcast(&threadpool->cond);
18989
+ }
18986
18990
ggml_mutex_unlock(&threadpool->mutex);
18987
18991
#else
18988
18992
UNUSED(threadpool);
You can’t perform that action at this time.
0 commit comments