Method code for $scheduler.unblock_task()

[Turn off line numbering]
  1: arg ident;
  2: var tasks;
  3: 
  4: // I want to be atomic!
  5: // The caller should have checked first, but we will fail silently.
  6: if (!.has_blocked_tasks(ident))
  7:     return;
  8: 
  9: // Get the blocked tasks queue for this identifier.
 10: tasks = blocked_tasks[ident];
 11: 
 12: // If this is the last blocked task, then clear the queue, otherwise
 13: // just delete the task_id that we are resuming.
 14: if (tasks.length() == 1)
 15:     blocked_tasks = blocked_tasks.del(ident);
 16: else
 17:     blocked_tasks = blocked_tasks.add(ident, tasks.delete(1));
 18: 
 19: // Wake it up and go.
 20: resume(tasks[1]);

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

Tlon