Documents
Writing Docs Gigedit SFZ Instrument Scripts NKSP Language NKSP Reference

callback_status()

Checks and returns the current status of the requested callback handler instance. You can use this function to check if a specific script execution instance (thread) is still alive. You have to pass the callback ID of the one you are intested in. There are various ways to get a callback ID. For example to get the currently running event handler's own callback ID you can read the built-in variable $NI_CALLBACK_ID which you then may hand over to other threads i.e. by storing it as user variable. Or if you spawned your own threads by calling fork() you may get the callback ID of the child threads by reading the array variable %NKSP_CALLBACK_CHILD_ID[], or for the parent thread by reading $NKSP_CALLBACK_PARENT_ID. Refer to fork() for more details about the latter two built-in variables.

Function Prototype

callback_status(callback-id)

Arguments

Argument Name Data Type Description
callback-id Callback ID Number Status of this script thread will be checked.
[required]

Return Value

Returns one of the following integer number values:

Value Description
$CALLBACK_STATUS_TERMINATED The callback is no longer alive and thus will no longer execute, so it either terminated regularly or because of an error.
$CALLBACK_STATUS_QUEUE The callback is alive, but is currently not executing. It is currently waiting to be resumed by the scheduler. This might be the case i.e. if the callback has just been created and has not been executed by the scheduler at all yet, or if the callback is currently suspended i.e. because it called wait() or because it was auto suspended by the script engine due to execution timing reasons.
$CALLBACK_STATUS_RUNNING The callback is alive and is actually executing at this moment. You will get this result value i.e. if a callback checks the status of itself.
Even though there are currently just three possible return values, $CALLBACK_STATUS_QUEUE and $CALLBACK_STATUS_RUNNING are defined as bit flags, and since other bit flags might be added in future you should only compare those two return values bitwise.

Examples

None yet.

Availability

Since LinuxSampler 2.0.0.svn66.

See also

event_status(), abort(), fork()

This function is only available with NKSP, it does not exist with KSP.

Document Updated:  2019-08-29  |  Author:  Christian Schoenebeck