diff --git a/zion/object/channel.cpp b/zion/object/channel.cpp index e7513d5..b519dfa 100644 --- a/zion/object/channel.cpp +++ b/zion/object/channel.cpp @@ -82,7 +82,9 @@ z_err_t Channel::EnqueueMessage(const ZMessage& msg) { pending_messages_.PushBack(message); if (blocked_threads_.size() > 0) { - gScheduler->Enqueue(blocked_threads_.PopFront()); + auto thread = blocked_threads_.PopFront(); + thread->SetState(Thread::RUNNABLE); + gScheduler->Enqueue(thread); } return Z_OK; } diff --git a/zion/object/port.cpp b/zion/object/port.cpp index 52e0cf1..dfbd134 100644 --- a/zion/object/port.cpp +++ b/zion/object/port.cpp @@ -27,7 +27,9 @@ z_err_t Port::Write(const ZMessage& msg) { MutexHolder lock(mutex_); pending_messages_.PushBack(message); if (blocked_threads_.size() > 0) { - gScheduler->Enqueue(blocked_threads_.PopFront()); + auto thread = blocked_threads_.PopFront(); + thread->SetState(Thread::RUNNABLE); + gScheduler->Enqueue(thread); } return Z_OK; }