X-Git-Url: http://git.silcnet.org/gitweb/?p=crypto.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcschedule_i.h;h=a88df592c8fb7bad88b4f183e16b50dc7a2d3cc8;hp=6c8d462d56eaf2948a51250f8fb0801e73f35a56;hb=60180da59ffdbbd12058dded66e3c8a547cd0852;hpb=687f7e441ffa2fa6a6726bc2851ca7c2c436be45 diff --git a/lib/silcutil/silcschedule_i.h b/lib/silcutil/silcschedule_i.h index 6c8d462d..a88df592 100644 --- a/lib/silcutil/silcschedule_i.h +++ b/lib/silcutil/silcschedule_i.h @@ -38,12 +38,15 @@ typedef enum { 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, + SILC_TASK_TIMEOUT = 1, /* 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 + SILC_TASK_SIGNAL = 2, + + /* Asynchronous event task. */ + SILC_TASK_EVENT = 3, } SilcTaskType; /* Task header */ @@ -51,7 +54,7 @@ struct SilcTaskStruct { struct SilcTaskStruct *next; SilcTaskCallback callback; void *context; - unsigned int type : 1; /* 0 = fd, 1 = timeout */ + unsigned int type : 2; /* SilcTaskType */ unsigned int valid : 1; /* Set if task is valid */ }; @@ -66,17 +69,26 @@ typedef struct SilcTaskFdStruct { struct SilcTaskStruct header; unsigned int scheduled : 1; unsigned int events : 14; - unsigned int revents : 15; + unsigned int revents : 14; SilcUInt32 fd; } *SilcTaskFd; +/* Event task */ +typedef struct SilcEventTaskStruct { + struct SilcTaskStruct header; + char *event; + SilcList connections; +} *SilcEventTask; + /* Scheduler context */ struct SilcScheduleStruct { + SilcSchedule parent; /* Parent scheduler */ void *internal; void *app_context; /* Application specific context */ SilcTaskNotifyCb notify; /* Notify callback */ void *notify_context; /* Notify context */ SilcStack stack; /* Stack */ + SilcHashTable events; /* Event tasks */ SilcHashTable fd_queue; /* FD task queue */ SilcList fd_dispatch; /* Dispatched FDs */ SilcList timeout_queue; /* Timeout queue */