Mark unblocked threads as runnable before enqueueing them
This commit is contained in:
parent
ffa2d97a64
commit
71e51730b7
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue