Added SILC errno API. Added SilcResult, generic error code and
[crypto.git] / lib / silcutil / tests / test_silcschedule.c
index 5a6824ccac31003556908d9e877b9bc03110ea2d..a86ba68e2ddcc13714bef3c86975d84fddf30f2b 100644 (file)
@@ -13,6 +13,15 @@ typedef void (*Callback)(void *context);
 
 SilcSchedule schedule;
 
+void notify_cb(SilcSchedule schedule, SilcBool added, SilcTask task,
+              SilcBool fd_task, SilcUInt32 fd, long sec, long usec,
+              void *context)
+{
+  SILC_LOG_DEBUG(("Notify cb, %s %s task, fd %d, sec %d usec %d",
+                 added ? "added" : "deleted", fd_task ? "fd" :"timeout",
+                 fd, sec, usec));
+}
+
 SILC_TASK_CALLBACK(foo)
 {
 
@@ -85,13 +94,14 @@ int main(int argc, char **argv)
     silc_log_debug(TRUE);
     silc_log_quick(TRUE);
     silc_log_debug_hexdump(TRUE);
-    silc_log_set_debug_string("*sched*,*hash*");
+    silc_log_set_debug_string("*sched*,*hash*,*errno*");
   }
 
   SILC_LOG_DEBUG(("Allocating scheduler"));
-  schedule = silc_schedule_init(NUM_FTASK, NULL);
+  schedule = silc_schedule_init(NUM_FTASK, NULL, NULL);
   if (!schedule)
     goto err;
+  silc_schedule_set_notify(schedule, notify_cb, NULL);
 
   silc_schedule_task_add_signal(schedule, SIGINT, interrupt, NULL);