pkill

Number0x08
Signature(task_handle) -> 0 or -err
Grouptask
Since1.0

Terminate a child process through its task handle. The process is killed unconditionally unlike pquit, which a process calls on itself, pkill is how a parent ends a child. The child exits with status KILLED_TAG | KILL_BY_PARENT, which the parent reads through wait.

The task handle is consumed: the parent’s slot is freed as the process is killed.

Pitfalls

This operates on whole processes. There is no way to kill an individual thread; a thread ends by returning from its entry point or calling tquit.

Arguments

RegisterNameDescription
r0task_handleSlot index of a task handle from `pspawn`

Returns

0 on success.

Errors

CodeCondition
ERR_BADHANDLENo such handle, or the task has no live process or thread
ERR_BADTYPEHandle is not a task handle

See also