X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Ftests%2Ftest_silcfsm.c;h=c801a5e0187bf3e4627489263953d7afdddbc33c;hb=40f8443d8d3a6577336ee66d18e04d9ac4d956bb;hp=9b7350074727dd5964e274e3a0c492e9f73f6d17;hpb=0f0340b9fbce9704cc7171f8f0104ce9103d2de6;p=silc.git diff --git a/lib/silcutil/tests/test_silcfsm.c b/lib/silcutil/tests/test_silcfsm.c index 9b735007..c801a5e0 100644 --- a/lib/silcutil/tests/test_silcfsm.c +++ b/lib/silcutil/tests/test_silcfsm.c @@ -1,6 +1,6 @@ /* SILC FSM tests */ -#include "silcincludes.h" +#include "silc.h" #include "silcfsm.h" typedef void (*Callback)(void *context); @@ -12,13 +12,13 @@ typedef struct FooStruct *Foo; typedef struct { SilcFSMThreadStruct thread; SilcFSMSemaStruct sema; - bool finished; + SilcBool finished; int rounds; Foo f; } T; struct FooStruct { - bool error; + SilcBool error; SilcFSM fsm; SilcFSMThreadStruct thread; int timeout; @@ -116,14 +116,9 @@ SILC_FSM_STATE(test_st_fourth) f->timeout = 1; SILC_LOG_DEBUG(("Creating FSM thread")); - if (!silc_fsm_thread_init(&f->thread, fsm, f, NULL, NULL, FALSE)) { - /** Error creating thread */ - SILC_LOG_DEBUG(("Error creating thread")); - f->error = TRUE; - silc_fsm_next(fsm, test_st_finish); - return SILC_FSM_CONTINUE; - } + silc_fsm_thread_init(&f->thread, fsm, f, NULL, NULL, FALSE); SILC_LOG_DEBUG(("Starting thread")); + /*** Start thread */ silc_fsm_start(&f->thread, test_thread_st_start); /** Waiting thread to terminate */ @@ -165,20 +160,14 @@ SILC_FSM_STATE(test_st_fifth) silc_fsm_sema_init(&f->sema, fsm, 0); SILC_LOG_DEBUG(("Creating FSM thread")); - if (!silc_fsm_thread_init(&f->thread, fsm, f, NULL, NULL, TRUE)) { - /** Error creating real thread */ - SILC_LOG_DEBUG(("Error creating thread")); - f->error = TRUE; - silc_fsm_next(fsm, test_st_finish); - return SILC_FSM_CONTINUE; - } + silc_fsm_thread_init(&f->thread, fsm, f, NULL, NULL, TRUE); SILC_LOG_DEBUG(("Starting thread")); silc_fsm_start(&f->thread, test_thread2_st_start); /** 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); + SILC_FSM_SEMA_TIMEDWAIT(&f->sema, 5, 0, NULL); return SILC_FSM_CONTINUE; } @@ -247,15 +236,8 @@ SILC_FSM_STATE(test_st_seventh) f->threads[i].rounds = 10; f->threads[i].f = f; silc_fsm_sema_init(&f->threads[i].sema, fsm, 0); - if (!silc_fsm_thread_init(&f->threads[i].thread, fsm, - &f->threads[i], NULL, NULL, FALSE)) { - /** Error creating thread */ - SILC_LOG_DEBUG(("Error creating thread")); - f->error = TRUE; - silc_fsm_next(fsm, test_st_finish); - return SILC_FSM_CONTINUE; - } - + 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); } @@ -317,15 +299,8 @@ SILC_FSM_STATE(test_st_ninth) f->threads2[i].rounds = 10; f->threads2[i].f = f; silc_fsm_sema_init(&f->threads2[i].sema, fsm, 0); - if (!silc_fsm_thread_init(&f->threads2[i].thread, fsm, - &f->threads2[i], NULL, NULL, TRUE)) { - /** Error creating real thread */ - SILC_LOG_DEBUG(("Error creating real thread")); - f->error = TRUE; - silc_fsm_next(fsm, test_st_finish); - return SILC_FSM_CONTINUE; - } - + 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); } @@ -374,7 +349,7 @@ static void destructor(SilcFSM fsm, void *fsm_context, int main(int argc, char **argv) { - bool success = FALSE; + SilcBool success = FALSE; SilcSchedule schedule; SilcFSM fsm; Foo f;