- silc_fsm_next_later(fsm, test_st_third, 2, 0);
+ silc_fsm_next_later(fsm, test_st_second_timeout, 2, 0);
+ return SILC_FSM_WAIT;
+}
+
+SILC_TASK_CALLBACK(test_second_timeout)
+{
+ Foo f = context;
+ SILC_LOG_DEBUG(("test_second_timeout"));
+
+ SILC_LOG_DEBUG(("Interrupt 3 second wait and continue immediately"));
+ f->c++;
+ silc_fsm_next(f->fsm, test_st_third);
+ silc_fsm_continue(f->fsm);
+}
+
+SILC_FSM_STATE(test_st_second_timeout)
+{
+ Foo f = fsm_context;
+
+ SILC_LOG_DEBUG(("test_st_second_timeout"));
+
+ /** Move to third state, timeout */
+ SILC_LOG_DEBUG(("Move to next state with 3 second timeout"));
+ SILC_LOG_DEBUG(("The timeout will be interrupted with silc_fsm_continue"));
+ silc_fsm_next_later(fsm, test_st_third, 3, 0);
+ silc_schedule_task_add_timeout(silc_fsm_get_schedule(fsm),
+ test_second_timeout, f, 2, 500000);