Method code for $scheduler.block_task()

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

// I want to be atomic!
// Add the task_id to the queue of blocked tasks for this identifier.
if (blocked_tasks.contains(ident))
    tasks = blocked_tasks[ident] + [task_id()];
else
    tasks = [task_id()];
blocked_tasks = blocked_tasks.add(ident, tasks);

// And go to sleep until we are woken.
return (> suspend() <);

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

Tlon