Section "tasks"
While there exists a primordial task “main”, the application
programmer can create further timers and/or tasks. The realization
is via stackless coroutines for timers and stackfull coroutines
for tasks. The stackless coroutines are executed inside their
creator stackfull coroutine and are not allowed to yield.
The following scheduler predicates are provided:
- call_later(G, T):
- call_later(G, D, T):
- The predicate succeeds. As a side effect it schedules the goal
G to be executed after D milliseconds. The ternary predicate
succceeds in T with the scheduled timer.
- timer_cancel(T):
- The predicate succeeds. As a side effect it cancels the timer
T.
- current_task(E):
- The predicate succeeds in E with the current task.
- create_task(G):
- create_task(G, T):
- The predicate succeeds. As a side effect it schedules the goal
G to be executed immediately. The binary predicate succceeds in
T with the new task.
- task_abort(E, M):
- The predicate succeeds. As a side effect the task E gets the
message M signalled.