EsAsyncTaskProcessQueueScheduler
An async task scheduler that uses the Smalltalk ProcessorScheduler priority queues to implement the scheduling algorithm for the async constructs.
Class Methods
None
Instance Methods
scheduleTask:at:
Schedule @aBlock to run async in a coordinated
fashion with other scheduled tasks.
We want to give the current process a chance
to finish setting up handlers, and other work, that
the current process is performing.
Therefore, the submission block is submitted at
a priority 1 less than the current process. Once the block
is activated, the process priority is changed to the requested
@taskPriority and rescheduled to run @aBlock
We also want to gaurantee that the submissions of tasks
are executed in the order in which they were submitted.
For this, we use the ProcessScheduler queue to help maintain
that order. Rather than a normal 'fork' of the submission block,
which places it at the front of the queue...we instead call #addToReadyLast:
to ensure the submissions line up in a queue like fashion.
@Note: To maintain the properties listed above, primarily where task
submission should be at a lower priority level than the current caller process,
an exception is thrown if the caller is running in a systemBackgroundPriority (1)
process. To work around this issue, fork off a new process of at least
userBackgroundPriority (2) to schedule the task.
Arguments:
aBlock - <Block>
Raises:
<EsAsyncScheduleTaskError>
Last modified date: 02/23/2021