Created SILC Runtime Toolkit git repository Part II.
[runtime.git] / lib / silcutil / tests / test_silcasync.c
index 0a1fecc8a1478d55a1cdebf68ea0c0de3868c865..7e8be9e38fde4b46e76c021cb897c428ec2cd43f 100644 (file)
@@ -1,6 +1,6 @@
 /* SilcAsyncOperation tests */
 
-#include "silc.h"
+#include "silcruntime.h"
 #include "silcfsm.h"
 #include "silcasync.h"
 
@@ -10,7 +10,7 @@ SilcSchedule schedule;
 
 typedef struct {
   SilcFSM fsm;
-  SilcFSMSemaStruct sema;
+  SilcFSMEventStruct sema;
   SilcAsyncOperation op;
   Callback cb;
   void *cb_context;
@@ -59,7 +59,7 @@ static void async_call_cb(void *context)
   Foo f = context;
   SILC_LOG_DEBUG(("*******Callback, signal and continue to next state"));
   f->op = NULL;
-  SILC_FSM_SEMA_POST(&f->sema);
+  SILC_FSM_EVENT_SIGNAL(&f->sema);
   SILC_FSM_CALL_CONTINUE(f->fsm);
 }
 
@@ -69,7 +69,7 @@ SILC_FSM_STATE(test_st_start)
 
   SILC_LOG_DEBUG(("test_st_start"));
 
-  silc_fsm_sema_init(&f->sema, fsm, 0);
+  silc_fsm_event_init(&f->sema, fsm);
 
   /** Wait async callback */
   SILC_LOG_DEBUG(("Call async call"));
@@ -84,7 +84,7 @@ SILC_FSM_STATE(test_st_second)
 
   SILC_LOG_DEBUG(("test_st_second"));
 
-  SILC_FSM_SEMA_TIMEDWAIT(&f->sema, 0, 1, &timedout);
+  SILC_FSM_EVENT_TIMEDWAIT(&f->sema, 0, 1, &timedout);
 
   if (timedout == TRUE) {
     SILC_LOG_DEBUG(("Sema timedout, aborting async operation"));
@@ -122,11 +122,11 @@ int main(int argc, char **argv)
   if (argc > 1 && !strcmp(argv[1], "-d")) {
     silc_log_debug(TRUE);
     silc_log_debug_hexdump(TRUE);
-    silc_log_set_debug_string("*async*");
+    silc_log_set_debug_string("*async*,*errno*");
   }
 
   SILC_LOG_DEBUG(("Allocating scheduler"));
-  schedule = silc_schedule_init(0, NULL);
+  schedule = silc_schedule_init(0, NULL, NULL, NULL);
 
   f = silc_calloc(1, sizeof(*f));
   if (!f)
@@ -154,5 +154,5 @@ int main(int argc, char **argv)
   SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE"));
   fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE");
 
-  return success;
+  return !success;
 }