op_pro_self()
Abstract
Obtains a process handle for the process currently executing.
Syntax
op_pro_self ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Prohandle
Process handle of the process currently executing. This handle can be used in calls to other KPs in order to perform operations related to this process.
Example
/* Get the pointer to the module wide variables. */
mod_vars = (TP_Global_State *) op_pro_modmem_access ();
/* Obtain a process handle for the current session process. */
local_process_handle = op_pro_self ();
/* Register new process in module-wide data structure and initialize */
/* parent-to-child communication memory. */
tp_sess_init (sess_config_ptr, mod_vars, op_pro_id (local_process_handle);
Details
The currently executing process often needs to use a handle for itself as the argument to other KPs in both the Process and Interrupt packages. For instance, this handle may serve as a point of reference to obtain handles for parent processes. Other typical uses include obtaining a process’ unique id, and having a process destroy itself when it is no longer useful.
Purpose
Provides a process handle for the process that called this KP. This handle is a required argument of many other KPs in the Process and Interrupt packages.
Errors
- Program Abort: KP requires process context.
Reference
- Use the KP op_pro_id() to obtain the unique integer ID of a process
- Use the KP op_pro_destroy() to destroy a process
- Use the KP op_intrpt_port_register() to register a process for particular stream or statistic interrupts
- Use the KP op_intrpt_type_register() to register a process for particular types of interrupts