X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcschedule_i.h;h=61ea48125a0d96d374db7f2730fd8d95cd6a2adc;hb=52e57c880aba9c5e89f59d962eb9af75670b76e0;hp=fcb47aa48bd8863b92237b8892971c6cd675bee7;hpb=827dcbc23c22e51638624aa1bc6cbf691757eed6;p=silc.git diff --git a/lib/silcutil/silcschedule_i.h b/lib/silcutil/silcschedule_i.h index fcb47aa4..61ea4812 100644 --- a/lib/silcutil/silcschedule_i.h +++ b/lib/silcutil/silcschedule_i.h @@ -27,6 +27,25 @@ #include "silchashtable.h" #include "silclist.h" +/* Task types */ +typedef enum { + /* File descriptor task that performs some event over file descriptors. + These tasks are for example network connections. */ + SILC_TASK_FD = 0, + + /* Timeout tasks are tasks that are executed after the specified + time has elapsed. After the task is executed the task is removed + automatically from the scheduler. It is safe to re-register the + task in task callback. It is also safe to unregister a task in + the task callback. */ + SILC_TASK_TIMEOUT, + + /* Platform specific process signal task. On Unix systems this is one of + the signals described in signal(7). On other platforms this may not + be available at all. Only one callback per signal may be added. */ + SILC_TASK_SIGNAL +} SilcTaskType; + /* Task header */ struct SilcTaskStruct { struct SilcTaskStruct *next; @@ -55,6 +74,8 @@ typedef struct SilcTaskFdStruct { struct SilcScheduleStruct { void *internal; void *app_context; /* Application specific context */ + SilcTaskNotifyCb notify; /* Notify callback */ + void *notify_context; /* Notify context */ SilcHashTable fd_queue; /* FD task queue */ SilcList fd_dispatch; /* Dispatched FDs */ SilcList timeout_queue; /* Timeout queue */ @@ -87,7 +108,8 @@ typedef struct { the wakeup mechanism of the scheduler. In multi-threaded environment the scheduler needs to be wakenup when tasks are added or removed from the task queues. Returns context to the platform specific scheduler. - If this returns NULL the scheduler initialization will fail. */ + If this returns NULL the scheduler initialization will fail. Do not + add FD tasks inside function. Timeout tasks can be added. */ void *(*init)(SilcSchedule schedule, void *app_context); /* Uninitializes the platform specific scheduler context. */