Scheduler 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, timeout tasks and asynchronous event tasks. File descriptor tasks are tasks that perform some operation over the specified file descriptor or socket. The timeout tasks are timeouts that are executed after the specified timeout has elapsed. Asynchronous event tasks are tasks that can be connected to and signalled to deliver messages and data to all connected entities.

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 one iteration, so that the scheduler does not block, and thus providing a possiblity that some external main loop is run over the SILC Scheduler.

On Windows 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.

On Symbian OS the SILC Scheduler can work in cooperation with the Active Scheduler. However, the Symbian OS Active Scheduler must be started before starting SILC Scheduler.

The SILC Scheduler supports multi-threads. Each thread can have their own scheduler. Tasks registered to a scheduler are always executed in that same thread. However, tasks may be added to and removed from any scheduler from any thread. Each scheduler in worker thread should be a child scheduler created from the main thread's parent scheduler.