SILC Schedule Interface
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
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