Scieneer Common Lisp 1.3.9 online documentation

thread:queue-task task-queue function &optional priority[Function]

Queue a function to be executed by the given task-queue. The optional priority is a zero based integer priority level and must be within the number of priority levels defined for the queue, see thread:make-task-queue. Tasks with a higher priority are queued to be executed before any lower priority tasks, and the new task is queued to execute after other tasks with the same priority. The default priority level is zero, the lowest priority.

If the task queue is enabled and the maximum task queue length has not been reached then the task is placed in the queue. Once a task has been queued it is generally executed even if the queue is subsequently shutdown or the maximum queue length reduced.

Three values are returned: 1. a success flag which if true if the task was queue otherwise false; 2. the queue length; 3. the number of threads busy executing tasks, which is the total minus the number of threads free to execute tasks.

When the task queue is enabled, a count of the number of calls is increased, see thread:task-queue-count. If the queue has reached its maximum length and the task is not queued then the thread:task-queue-dropped-count is increased. If no threads are available to execute the task, and none can be created because the maximum threads limited has been reached, then the thread:task-queue-deferred-count is increased.

If the task queue is disabled then a new thread is created to execute the task, returning t, 0, and 0. If ext:quit has been called then no further tasks will be queued, returning nil, 0, and 0.