atomic()
INTEGER atomic(INTEGER goatomic)
This function is used to turn on and off atomic execution. When executing atomically no other tasks will be run. This also means that any function that normally preempts will throw an error (with the exception of refresh()). If the argument is 0 (false) the interpreter stops executing atomically. If the argument is any other integer (true) the interpreter starts executing atomically.
Note: read Frames and Tasks before using this function.
call_trace()
LIST|INTEGER call_trace()
Depending on the debug mode, one of the following will be returned:
mode 0
Return 0 (zero).
mode 1
Returns a list of samples gathered by the debugger. Each method call is sampled as the list [tick#, this, definer, method]:
| tick# | Tick in which the call occured. |
| this | Receiver of the call. |
| definer | Definer of the called method. |
| method | Method name (a symbol). |
Each method return is sampled as a tick number.
Note: The tick counts will be off if the task has been preepmpted and another task executed during the pause.
mode 2
In addition to the above, each method call has fifth element that is a list of all the arguments passed in the call. Optional arguments (those defined as @rest in the argument list) are gathered into a list and placed into the result as a single element.
This function will automatically set the debug mode to 0.
caller()
OBJNUM caller()
This function returns the dbref of the object which defines the method which called the current method. If the current method was called by the driver, 0 (zero) is returned.
cancel()
INTEGER cancel(INTEGER task_id)
This function cancels the suspended or preempted task with the task id given by task_id. If the task does not exist, the error ~type is thrown.
debug_callers()
INTEGER debug_callers(INTEGER mode)
This function sets the debug mode for call_trace(). If mode is set to a non-zero value, the method calling sampler will automatically start. Any non-zero mode value other than 2 will result in call_trace() using mode 1. This function will always return the value passed in mode.
definer()
OBJNUM definer()
This function returns the dbref of the object which defines the current method.
method()
SYMBOL method()
This function returns the name of the current method as a symbol.
pass()
ANY pass(...)
This function is used to call an overridden method from the current method. When called, any arguments sent to pass() are sent to the overridden method as if it had been called with those arguments. When passing to a method, the current frame's values do not change (i.e. the caller and sender stay the same as in the method that is passing back). For more information see Overridden Methods.
pause()
INTEGER pause()
This function instantly preempts the current task, letting other tasks execute before it resumes execution with a refreshed tick count. See Frames and Tasks for more information on preempting and task control.
refresh()
INTEGER refresh()
When the server is running non-atomically, this function checks the current frame's tick count and preempts the task if it is nearly depleted (similar to pause()) and resumes it with a new tick count after all other current tasks have completed. If the tick count is not close to depletion, the function does not do anything. If the server is running atomically, the task will not preempt, but the tick count will automatically be refreshed. See Frames and Tasks for more information on task preempting.
resume()
INTEGER resume(INTEGER task_id[, ANY value])
This function resumes the suspended task specified by the argument task_id. The error ~type is thrown if the task does not exist. The optional second argument value is used as the return value for the function suspend(). If a second argument is not specified the return value of suspend() is 0 (zero). See Frames and Tasks for more information on preempting and task control.
sender()
OBJNUM sender()
This function returns the objnum of the object which called the current method. If the current method was called by the driver, 0 (zero) is returned instead. Further information can be found in Frames and Tasks.
set_user()
INTEGER set_user()
This function sets the task's user to the current object. Later calls to the function user() will return this object, until this function is called again. If no user is set, 0 (zero) is returned instead. This is intended as an easy means to define a controlling object for a task.
stack()
LIST stack()
This function returns the call stack for the current task. Each element in the list is a list representing a specific frame. The first element represents the first frame, and so on, up to the current frame.
Each frame list is ordered as follows:
- OBJNUM sender
- OBJNUM caller
- SYMBOL method name
- INTEGER line number
- INTEGER current op code
suspend()
ANY suspend()
This function suspends the current task indefinitely. A suspended task is resumed by calling the function (in another task) resume(). The return value of suspend is given as the second argument to resume(). If no second argument is given, the return value of suspend() is 0 (zero). See Frames and Tasks for more information on task control.
task_id()
INTEGER task_id()
This function returns the task id for the current task. See Frames and Tasks for more information on preempting and task control.
task_info()
LIST task_info(INTEGER task_id)
This function returns full information on the task specified with the argument task_id. If the task does not exist, the error ~type is thrown. The returned list contains a minimum of seven elements, with subsequent elements defining the specific frames, these are:
- INTEGER task id
- INTEGER preempted
- INTEGER datasize limit
- INTEGER fork limit
- INTEGER recursion limit
- INTEGER objswap limit
- INTEGER calldepth limit
- LIST frame
- ...
The second element preempted is true if this task was preempted, false if it was suspended. For more information on the limit elements, see config(). Remaining frame elements are eight-element lists formatted as:
- OBJNUM current object
- OBJNUM caller
- OBJNUM sender
- OBJNUM user
- INTEGER current opcode
- INTEGER last opcode
- INTEGER ticks remaining
- SYMBOL method name
tasks()
LIST tasks()
This function returns a list of integers, where each integer is the task id for a currently suspended or preempted task.
this()
OBJNUM this()
This function returns the objnum of the current object.
tick()
INTEGER tick()
This function returns the current system-wide tick. It exists for backwards compatibility and should not be used.
ticks_left()
INTEGER ticks_left()
This function returns the ticks remaining for the current frame. See Frames and Tasks for more information on frames and ticks.
user()
INTEGER user()
This function returns the task's user, as it was set with set_user(). If no user was set, 0 (zero) is returned instead. This is intended as an easy means to define a controlling object for a task.