diff --git a/src/vm/gc.cpp b/src/vm/gc.cpp index e4e6ebf..b3cb524 100644 --- a/src/vm/gc.cpp +++ b/src/vm/gc.cpp @@ -113,9 +113,8 @@ void GC::Start() { this->thrd = new Thread([this]() -> void { while (this->IsRunning()) { this->BarrierBegin(); - while (this->allocs < ALLOC_THRESHOLD) - this->cond.Wait( - &this->mtx); // your wrapper around pthread_cond_wait + while (this->IsRunning() && (this->allocs < ALLOC_THRESHOLD)) + this->cond.Wait(&this->mtx); this->allocs = 0; std::vector to_delete; this->Collect(to_delete);