+
+#ifdef SILC_THREADS
+
+/* Internal wakeup context. */
+typedef struct {
+ HANDLE wakeup_sema;
+ SilcTask wakeup_task;
+} *SilcWin32Wakeup;
+
+SILC_TASK_CALLBACK(silc_schedule_wakeup_cb)
+{
+ /* Nothing */
+}
+
+#endif /* SILC_THREADS */
+
+/* Initializes the platform specific scheduler. This for example initializes
+ the wakeup mechanism of the scheduler. In multi-threaded environment
+ the scheduler needs to be wakenup when tasks are added or removed from
+ the task queues. Returns context to the platform specific scheduler. */
+
+void *silc_schedule_internal_init(SilcSchedule schedule, void *app_context)
+{
+#ifdef SILC_THREADS
+ SilcWin32Wakeup wakeup;
+
+ wakeup = silc_calloc(1, sizeof(*wakeup));
+
+ wakeup->wakeup_sema = CreateSemaphore(NULL, 0, 100, NULL);
+ if (!wakeup->wakeup_sema) {
+ silc_free(wakeup);
+ return NULL;
+ }
+
+ wakeup->wakeup_task =
+ silc_schedule_task_add(schedule, (int)wakeup->wakeup_sema,
+ silc_schedule_wakeup_cb, wakeup,
+ 0, 0, SILC_TASK_FD,
+ SILC_TASK_PRI_NORMAL);
+ if (!wakeup->wakeup_task) {
+ CloseHandle(wakeup->wakeup_sema);
+ silc_free(wakeup);
+ return NULL;
+ }
+
+ return (void *)wakeup;
+#else
+ return NULL;
+#endif
+}
+
+/* Uninitializes the platform specific scheduler context. */
+
+void silc_schedule_internal_uninit(void *context)
+{
+#ifdef SILC_THREADS
+ SilcWin32Wakeup wakeup = (SilcWin32Wakeup)context;
+
+ if (!wakeup)
+ return;
+
+ CloseHandle(wakeup->wakeup_sema);
+ silc_free(wakeup);
+#endif
+}
+
+/* Wakes up the scheduler */
+
+void silc_schedule_internal_wakeup(void *context)
+{
+#ifdef SILC_THREADS
+ SilcWin32Wakeup wakeup = (SilcWin32Wakeup)context;
+
+ if (!wakeup)
+ return;
+
+ ReleaseSemaphore(wakeup->wakeup_sema, 1, NULL);
+#endif
+}
+
+/* Register signal */
+
+void silc_schedule_internal_signal_register(void *context,
+ SilcUInt32 signal,
+ SilcTaskCallback callback,
+ void *callback_context)
+{
+
+}
+
+/* Unregister signal */
+
+void silc_schedule_internal_signal_unregister(void *context,
+ SilcUInt32 signal,
+ SilcTaskCallback callback,
+ void *callback_context)
+{
+
+}
+
+/* Mark signal to be called later. */
+
+void silc_schedule_internal_signal_call(void *context, SilcUInt32 signal)
+{
+
+}
+
+/* Call all signals */
+
+void silc_schedule_internal_signals_call(void *context,
+ SilcSchedule schedule)
+{
+
+}
+
+/* Block registered signals in scheduler. */
+
+void silc_schedule_internal_signals_block(void *context)
+{
+
+}
+
+/* Unblock registered signals in schedule. */
+
+void silc_schedule_internal_signals_unblock(void *context)
+{
+
+}