typedef struct {
SilcFSMThreadStruct thread;
- SilcFSMSemaStruct sema;
+ SilcFSMEventStruct sema;
SilcBool finished;
int rounds;
Foo f;
SilcFSM fsm;
SilcFSMThreadStruct thread;
int timeout;
- SilcFSMSemaStruct sema;
+ SilcFSMEventStruct sema;
SilcSchedule schedule;
Callback cb;
void *cb_context;
f->timeout = 7;
- SILC_LOG_DEBUG(("Creating FSM semaphore"));
- silc_fsm_sema_init(&f->sema, fsm, 0);
+ SILC_LOG_DEBUG(("Creating FSM event"));
+ silc_fsm_event_init(&f->sema, fsm);
SILC_LOG_DEBUG(("Creating FSM thread"));
silc_fsm_thread_init(&f->thread, fsm, f, NULL, NULL, TRUE);
/** Waiting thread to terminate, timeout */
SILC_LOG_DEBUG(("Waiting for thread to terminate for 5 seconds"));
silc_fsm_next(fsm, test_st_sixth);
- SILC_FSM_SEMA_TIMEDWAIT(&f->sema, 5, 0, NULL);
+ SILC_FSM_EVENT_TIMEDWAIT(&f->sema, 5, 0, NULL);
return SILC_FSM_CONTINUE;
}
SILC_LOG_DEBUG(("test_thread2_st_finish"));
SILC_LOG_DEBUG(("Post semaphore"));
- SILC_FSM_SEMA_POST(&f->sema);
+ SILC_FSM_EVENT_SIGNAL(&f->sema);
SILC_LOG_DEBUG(("Finishing the thread"));
return SILC_FSM_FINISH;
T *t = fsm_context;
if (t->rounds == 0) {
- SILC_FSM_SEMA_POST(&t->sema);
+ SILC_FSM_EVENT_SIGNAL(&t->sema);
return SILC_FSM_FINISH;
}
for (i = 0; i < NUM_THREADS; i++) {
f->threads[i].rounds = 10;
f->threads[i].f = f;
- silc_fsm_sema_init(&f->threads[i].sema, fsm, 0);
+ silc_fsm_event_init(&f->threads[i].sema, fsm);
silc_fsm_thread_init(&f->threads[i].thread, fsm,
&f->threads[i], NULL, NULL, FALSE);
silc_fsm_start(&f->threads[i].thread, test_thread3_st_start);
for (i = 0; i < NUM_THREADS; i++) {
if (f->threads[i].finished == FALSE) {
- SILC_FSM_SEMA_WAIT(&f->threads[i].sema);
+ SILC_FSM_EVENT_WAIT(&f->threads[i].sema);
f->threads[i].finished = TRUE;
}
}
T *t = fsm_context;
if (t->rounds == 0) {
- SILC_FSM_SEMA_POST(&t->sema);
+ SILC_FSM_EVENT_SIGNAL(&t->sema);
return SILC_FSM_FINISH;
}
SILC_LOG_DEBUG(("test_st_ninth"));
- SILC_LOG_DEBUG(("Creating FSM semaphore"));
- silc_fsm_sema_init(&f->sema, fsm, NUM_THREADS + 1);
+ SILC_LOG_DEBUG(("Creating FSM event"));
+ silc_fsm_event_init(&f->sema, fsm);
SILC_LOG_DEBUG(("Creating %d real FSM threads", NUM_THREADS));
for (i = 0; i < NUM_THREADS; i++) {
f->threads2[i].rounds = 10;
f->threads2[i].f = f;
- silc_fsm_sema_init(&f->threads2[i].sema, fsm, 0);
+ silc_fsm_event_init(&f->threads2[i].sema, fsm);
silc_fsm_thread_init(&f->threads2[i].thread, fsm,
&f->threads2[i], NULL, NULL, TRUE);
silc_fsm_start(&f->threads2[i].thread, test_thread4_st_start);
for (i = 0; i < NUM_THREADS; i++)
if (f->threads2[i].finished == FALSE) {
- SILC_FSM_SEMA_WAIT(&f->threads2[i].sema);
+ SILC_FSM_EVENT_WAIT(&f->threads2[i].sema);
f->threads2[i].finished = TRUE;
}