-/****h* silcutil/silcschedule.h
- *
- * NAME
- *
- * silcschedule.h
- *
- * COPYRIGHT
- *
- * Author: Pekka Riikonen <priikone@silcnet.org>
- *
- * Copyright (C) 1998 - 2001 Pekka Riikonen
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/*
+
+ silcschedule.h
+
+ COPYRIGHT
+
+ Author: Pekka Riikonen <priikone@silcnet.org>
+
+ Copyright (C) 1998 - 2001 Pekka Riikonen
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+*/
+
+/****h* silcutil/SilcScheduleAPI
*
- # DESCRIPTION
+ * 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,
* application could be created by allocating own scheduler for each of the
* worker threads.
*
- */
+ ***/
#ifndef SILCSCHEDULE_H
#define SILCSCHEDULE_H
*
* NAME
*
- * typedef enum { ... } SilcTaskPriority
+ * typedef enum { ... } SilcTaskPriority;
*
* DESCRIPTION
*
} SilcTaskPriority;
/***/
-/****f* silcutil/SilcScheduleAPI/silc_schedule_init
+/****f* silcutil/SilcScheduleAPI/SilcTaskCallback
*
* SYNOPSIS
*
* typedef void (*SilcTaskCallback)(SilcSchedule schedule,
- * SilcTaskEvent type, uint32 fd,
+ * SilcTaskEvent type, SilcUInt32 fd,
* void *context);
*
* DESCRIPTION
*
***/
typedef void (*SilcTaskCallback)(SilcSchedule schedule, SilcTaskEvent type,
- uint32 fd, void *context);
+ SilcUInt32 fd, void *context);
/* Macros */
*/
#define SILC_TASK_CALLBACK(func) \
static void func(SilcSchedule schedule, SilcTaskEvent type, \
- uint32 fd, void *context)
+ SilcUInt32 fd, void *context)
/***/
-/****d* silcutil/SilcScheduleAPI/SILC_TASK_CALLBACK
+/****d* silcutil/SilcScheduleAPI/SILC_TASK_CALLBACK_GLOBAL
*
* NAME
*
*/
#define SILC_TASK_CALLBACK_GLOBAL(func) \
void func(SilcSchedule schedule, SilcTaskEvent type, \
- uint32 fd, void *context)
+ SilcUInt32 fd, void *context)
/***/
/* Prototypes */
***/
bool silc_schedule_uninit(SilcSchedule schedule);
+/****f* silcutil/SilcScheduleAPI/silc_schedule_reinit
+ *
+ * SYNOPSIS
+ *
+ * SilcSchedule silc_schedule_reinit(int max_tasks);
+ *
+ * DESCRIPTION
+ *
+ * This function can be called to enlarge the task handling capabilities
+ * of the scheduler indicated by `schedule'. The `max_tasks' must be
+ * larger than what was set in silc_schedule_init function. This function
+ * returns FALSE if it cannot reinit the scheduler. This function does
+ * not do anything else except ready the scheduler to handle `max_tasks'
+ * number of tasks after this function returns. It is safe to call this
+ * function at any time, and it is guaranteed that existing tasks remain
+ * as they are in the scheduler.
+ *
+ ***/
+bool silc_schedule_reinit(SilcSchedule schedule, int max_tasks);
+
/****f* silcutil/SilcScheduleAPI/silc_schedule_stop
*
* SYNOPSIS
*
* Stops the scheduler even if it is not supposed to be stopped yet.
* After calling this, one must call silc_schedule_uninit (after the
- * silc_schedule has returned).
+ * silc_schedule has returned). After this is called it is guaranteed
+ * that next time the scheduler enters the main loop it will be stopped.
+ * However, untill it enters the main loop it will not detect that
+ * it is stopped for example if this is called from another thread.
*
***/
void silc_schedule_stop(SilcSchedule schedule);
***/
void silc_schedule(SilcSchedule schedule);
-/****f* silcutil/SilcScheduleAPI/silc_schedule
+/****f* silcutil/SilcScheduleAPI/silc_schedule_one
*
* SYNOPSIS
*
*
* SYNOPSIS
*
- * SilcTask silc_schedule_task_add(SilcSchedule schedule, uint32 fd,
+ * SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
* SilcTaskCallback callback,
* void *context,
* long seconds, long useconds,
* in other threads as well.
*
***/
-SilcTask silc_schedule_task_add(SilcSchedule schedule, uint32 fd,
+SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
SilcTaskCallback callback, void *context,
long seconds, long useconds,
SilcTaskType type,
*
* SYNOPSIS
*
- * void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd);
+ * void silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd);
*
* DESCRIPTION
*
* in task callbacks (including in the task's own task callback) and
* in multi-threaded environment in other threads as well.
*
+ * Note that generic tasks cannot be deleted using this function
+ * since generic tasks does not match any specific fd.
+ *
***/
-void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd);
+void silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd);
/****f* silcutil/SilcScheduleAPI/silc_schedule_task_del_by_callback
*
*
* SYNOPSIS
*
- * void silc_schedule_set_listen_fd(SilcSchedule schedule, uint32 fd,
+ * void silc_schedule_set_listen_fd(SilcSchedule schedule, SilcUInt32 fd,
* SilcTaskEvent mask);
*
* DESCRIPTION
* times to change the events.
*
***/
-void silc_schedule_set_listen_fd(SilcSchedule schedule, uint32 fd,
+void silc_schedule_set_listen_fd(SilcSchedule schedule, SilcUInt32 fd,
SilcTaskEvent mask);
/****f* silcutil/SilcScheduleAPI/silc_schedule_unset_listen_fd
*
* SYNOPSIS
*
- * void silc_schedule_unset_listen_fd(SilcSchedule schedule, uint32 fd);
+ * void silc_schedule_unset_listen_fd(SilcSchedule schedule, SilcUInt32 fd);
*
* DESCRIPTION
*
* after calling this function.
*
***/
-void silc_schedule_unset_listen_fd(SilcSchedule schedule, uint32 fd);
+void silc_schedule_unset_listen_fd(SilcSchedule schedule, SilcUInt32 fd);
#endif