op_intrpt_schedule_mcast_global()
Abstract
Schedules an mcast interrupt for every processor and queue module, at the specified time.
Syntax
op_intrpt_schedule_mcast_global (time, code)
| Argument | Type | Description |
|---|---|---|
time |
double |
scheduled time for the interrupt [This value is an absolute simulation time, rather than a delay relative to the current simulation time. If the “sim_time_quantum“ preference has a value other than 0.0, time will be truncated internally to a multiple of the specified quantum.] |
code |
int |
user-defined numeric code for association with the interrupt [This value is an arbitrary, user-defined integer which can be used as an identification code for the scheduled interrupt; the code can be obtained when the interrupt invokes the process, using the KP op_intrpt_code().] |
Return Type
Evhandle
Event handle for the scheduled interrupt.
[This returned value can be stored in a state variable, for possible later use to identify the interrupt in an invocation of op_ev_cancel().]
Example
/* Send a packet into the channel and calculate the transmission time that it requires. */
tx_time = (double) op_pk_total_size_get (pkptr) / DATA_RATE;
op_pk_send (pkptr, 0);
/* Compute the next time at which the channel will become available, */
/* and assign the transmission opportunity a new "slot" index. */
chan_avail_time = op_sim_time () + tx_time; slot_index++;
/* Notify processors in all terminals of the availability time and slot index. */
op_intrpt_schedule_mcast_global (chan_avail_time, slot_index);
Details
Invoking this KP places new events on the simulation event list; these new events represent a multicast interrupt that is scheduled to be delivered at the specified time. As soon as the events are scheduled, this KP returns control to the invoking process, which is then free to pursue any activities. The events will take place at the scheduled simulation time, but not before the execution of other higher priority events scheduled for that specific simulation time. When all earlier events have been executed, and the first multicast interrupt event is at the head of the simulation event list, its simulation time is established as the current simulation time and the event is executed. The execution of the event causes the multicast interrupt to be delivered to the modules. Each module’s process can obtain the specified code associated with the interrupt via the KP op_intrpt_code().
In cases where a multicast interrupt is signifying an optional activity, it is sometimes necessary to cancel the multicast interrupt due to changing conditions. Cancelling an interrupt requires that the event handle returned by this KP be stored in a state variable, to be later passed to the cancel KP, as shown in the following examples:
/* state variable declaration */
Evhandle \evh;
/* multicast interrupt scheduling */
evh = op_intrpt_schedule_mcast_global (stime, 22);
/* multicast interrupt cancelling */
op_ev_cancel (evh);
Purpose
Provides a mechanism for remotely invoking all processes from one, without requiring a physical packet stream or statistic wire connection between them. This is useful when one process needs to alert the other processes that something of interest has occurred (for instance, a satellite process signals the beginning of a transmission time slot).
Errors
- Program Abort: Allocation of memory failed.
- Recoverable Error: Specified time (
<time>) is less than current time. - Recoverable Error: Specified time (
<time>) is an invalid double value.
Reference
- Use the KP op_intrpt_schedule_remote() to schedule a remote interrupt
- Use the KP op_intrpt_force_remote() to force a remote interrupt
- Use the KP op_intrpt_schedule_call() to schedule a procedure interrupt
- Use the KP op_ev_cancel() to cancel a pending interrupt
- Use the KP op_intrpt_code() to obtain the code associated with an incoming interrupt