Function cmb_event_schedule

Function Documentation

uint64_t cmb_event_schedule(cmb_event_func *action, void *subject, void *object, double time, int64_t priority)

Insert an event in the event queue as indicated by the activation time and priority. An event cannot be scheduled at a time before the current simulation time.

Parameters:
  • action – Pointer to the event function to execute.

  • subject – Pointer to something user-defined, intended as a self-pointer for whatever entity (e.g., a cmb_process) is acting here.

  • object – Pointer to something user-defined, intended as a pointer to whatever object the subject is acting on.

  • time – The simulation time when this event will occur. The time argument must be greater than or equal to the current simulation time when making this call.

  • priority – The priority of this event at the scheduled time, an integer between INT64_MINand INT64_MAX. Events with numerically higher priority will happen before events with lower if scheduled at the same time. If both are equal, they will occur in FIFO sequence.

Returns:

The unique handle of the scheduled event, to be used as a reference for any rescheduling or cancellation of this event.