op_ici_destroy()
Abstract
Deallocates the specified ICI, releasing associated memory resources for other purposes.
Syntax
op_ici_destroy (iciptr)
| Argument | Type | Description |
|---|---|---|
iciptr |
Ici * |
pointer to the ICI-of-interest [A pointer to an ICI can be obtained from two KPs: op_ici_create() returns a pointer to a newly allocated ICI (in an ICI-sending process), and op_intrpt_ici() returns a pointer to an ICI associated with an incoming interrupt (in an ICI-receiving process).] |
Return Type
void
no return value
Example
Excerpt from: example model (models\std\x25); process model (x25_dte_rt); state “startup”
/* The DTE is trying to open the data link. */
switch (op_intrpt_type ())
{
case OPC_INTRPT_REMOTE:
/* Check for ICI indicating link established. */
if ((iciptr = op_intrpt_ici ()) != OPC_NIL);
{
op_ici_attr_get (iciptr, "primitive", &primitive);
if (primitive == OSIC_DL_CONNECT_INDICATION)
{
x25_dte_trace_msg ("Data link connection established");
timer_stop (&timer);
link_alive = 1;
timer.delay = mod_vars.mv_timer_value [X25C_T20];
timer.code = X25C_T20;
}
/* The ICI’s contents have been extracted so it can be discarded. */
op_ici_destroy (iciptr);
}
Details
When a specific ICI will no longer be accessed or installed, memory resources allocated for it should be released for re-use in the creation of new ICIs. A failure to release unused ICI memory to the Simulation Kernel can result in a build up of outstanding ICIs. This may eventually cause a simulation to halt if it attains maximum virtual memory usage and it can no longer satisfy allocation requests for new objects.
Purpose
Provides a mechanism for “recycling” memory associated with ICIs which will no longer be used. The Simulation Kernel is free to assign this memory to other dynamic objects as needed by the progressing simulation. This KP should be invoked whenever an ICI is to be removed from access by processes. After invocation of this KP, the specified ICI pointer should be considered invalid (i.e., it can no longer be referenced or passed to KPs).
Errors
- Program Abort: Segmentation violation. (due to an invalid ICI pointer or malformed ICI data structure)
- Recoverable Error: ICI pointer is NIL
Reference
- Use the KP op_ici_create() to perform the inverse operation and create an ICI
- Use the KP op_intrpt_ici() to obtain the pointer to an ICI associated with an incoming interrupt
- Use the KPs op_ici_attr_set_dbl(), op_ici_attr_set_int32(), op_ici_attr_set_int64(), and op_ici_attr_set_ptr() to assign the value of an ICI attribute
- Use the KP op_ici_install() to install an ICI for association with outgoing interrupts