SilcTaskCallback

SYNOPSIS

    typedef void (*SilcTaskCallback)(SilcSchedule schedule,
                                     void *app_context,
                                     SilcTaskEvent type, SilcUInt32 fd,
                                     void *context);

DESCRIPTION

The task callback function. This function will be called by the scheduler when some event of the task is performed. For example, when data is available from the connection this will be called.

The `schedule' is the scheduler context, the `type' is the indicated event, the `fd' is the file descriptor of the task and the `context' is a caller specified context. If multiple events occurred this callback is called separately for all events. The `app_context' is application specific context that was given as argument to the silc_schedule_init function. If the task is timeout task then `fd' is zero (0).

To specify task callback function in the application using the SILC_TASK_CALLBACK macro is recommended.

The callback should not perform lenghty or blocking operations as this would also block all other waiting tasks. The task callback should either handle the operation fast or issue an asynchronous call (like to register 0 timeout task) to handle it later.