silcschedule.html
SILC Schedule Interface Header: silcschedule.h
DESCRIPTION
The SILC Scheduler is the heart of any application. The scheduler provides
the application's main loop that can handle incoming data, outgoing data,
timeouts and dispatch different kind of tasks.
The SILC Scheduler supports file descriptor based tasks and timeout tasks.
File descriptor tasks are tasks that perform some operation over the
specified file descriptor. These include network connections, for example.
The timeout tasks are timeouts that are executed after the specified
timeout has elapsed.
The SILC Scheduler is designed to be the sole main loop of the application
so that the application does not need any other main loop. However,
SILC Scheduler does support running the scheduler only once, so that the
scheduler does not block, and thus providing a possiblity that some
external main loop is run over the SILC Scheduler.
Typical application first initializes the scheduler and then registers
the very first tasks to the scheduler and then run the scheduler. After
the scheduler's run function returns the application is considered to be
ended.
On WIN32 systems the SILC Scheduler is too designed to work as the main
loop of the GUI application. It can handle all Windows messages and
it dispatches them from the scheduler, and thus makes it possible to
create GUI applications. The scheduler can also handle all kinds of
WIN32 handles, this includes sockets created by the SILC Net API routines,
WSAEVENT handle objects created by Winsock2 routines and arbitrary
WIN32 HANDLE objects.
The SILC Scheduler supports multi-threads as well. The actual scheduler
must be run in single-thread but other threads may register new tasks
and unregister old tasks. However, it is enforced that the actual
task is always run in the main thread. The scheduler is context based
which makes it possible to allocate several schedulers for one application.
Since the scheduler must be run in single-thread, a multi-threaded
application could be created by allocating own scheduler for each of the
worker threads.
SilcSchedule
SilcTask
SilcTaskEvent
SilcTaskCallback
SilcTaskNotifyCb
SILC_ALL_TASKS
SILC_TASK_CALLBACK
silc_schedule_init
silc_schedule_uninit
silc_schedule_stop
silc_schedule
silc_schedule_one
silc_schedule_wakeup
silc_schedule_get_context
silc_schedule_set_notify
silc_schedule_task_add_fd
silc_schedule_task_add_timeout
silc_schedule_task_add_signal
silc_schedule_task_del
silc_schedule_task_del_by_fd
silc_schedule_task_del_by_callback
silc_schedule_task_del_by_context
silc_schedule_task_del_by_all
silc_schedule_set_listen_fd
silc_schedule_get_fd_events
silc_schedule_unset_listen_fd
|