SILC_FSM_EVENT_TIMEDWAIT

NAME

    SILC_FSM_EVENT_TIMEDWAIT(event, seconds, useconds, timedout)

DESCRIPTION

Macro used to wait for the `event' to be signalled, or until the timeout specified by `seconds' and `useconds' has elapsed. If the timeout occurs before the event is signalled, the machine will wakeup. The `timedout' is SilcBool pointer and if it is non-NULL indication of whether timeout occurred or not is saved to the pointer. This macro can only be used in FSM state functions. When the event is signalled or timedout the FSM will re-enter the current state (or state that was set with silc_fsm_next before waiting).

EXAMPLE

    SILC_FSM_STATE(silc_foo_state)
    {
      SilcBool timedout;
      ...

      // Wait here for async call to complete, or 10 seconds for timeout
      SILC_FSM_EVENT_TIMEDWAIT(ctx->async_event, 10, 0, &timedout);

      // See if timeout occurred
      if (timedout == TRUE)
        fatal(error);

      // Async call completed
      if (ctx->async_success == FALSE)
        fatal(error);
      ...
    }