PostSharpAPI ReferencePost­Sharp.​Patterns.​ThreadingActor­DispatcherMust­Yield
Open sandboxFocus

ActorDispatcher.MustYield Method


Determines whether the ProcessQueue() method should interrupt the processing of the message queue before the queue is empty.

protected virtual bool MustYield(int count)
Type Name Description
Int32 count

Number of messages already processed by the current invocation of the ProcessQueue() method.

Type Description

true if the ProcessQueue() method should stop processing messages, false if it should continue.


When this method returns true, the ProcessQueue() method will immediately invoke the ScheduleProcessQueue() method to process remaining messages.

The purpose of this method is to allow custom implementations of the ActorDispatcher class, which may dispatch the message queue execution on a pool composed of a small numbers of threads, to prevent a few actors to consume all available threads.