Method code for $scheduler.unblock_task()

[Turn on line numbering]
arg ident;
var tasks;

// I want to be atomic!
// The caller should have checked first, but we will fail silently.
if (!.has_blocked_tasks(ident))
    return;

// Get the blocked tasks queue for this identifier.
tasks = blocked_tasks[ident];

// If this is the last blocked task, then clear the queue, otherwise
// just delete the task_id that we are resuming.
if (tasks.length() == 1)
    blocked_tasks = blocked_tasks.del(ident);
else
    blocked_tasks = blocked_tasks.add(ident, tasks.delete(1));

// Wake it up and go.
resume(tasks[1]);

// Miroslav Silovic
// Created 05-Sep-1995 as a part of ColdCore, see: @help Credit

Tlon