aboutsummaryrefslogtreecommitdiff
path: root/src/util/scheduler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/scheduler.c')
-rw-r--r--src/util/scheduler.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index dd0ce6054..692c4f0b7 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -246,6 +246,39 @@ static enum GNUNET_SCHEDULER_Priority max_priority_added;
246static int current_lifeness; 246static int current_lifeness;
247 247
248/** 248/**
249 * Function to use as a select() in the scheduler.
250 * Defaults to GNUNET_NETWORK_socket_select ()
251 */
252GNUNET_SCHEDULER_select scheduler_select = GNUNET_NETWORK_socket_select;
253
254/**
255 * Sets the select function to use in the scheduler (scheduler_select).
256 *
257 * @param new_select new select function to use
258 * @return previously used select function
259 */
260GNUNET_SCHEDULER_select
261GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select)
262{
263 GNUNET_SCHEDULER_select old_select = scheduler_select;
264 scheduler_select = new_select;
265 if (scheduler_select == NULL)
266 scheduler_select = GNUNET_NETWORK_socket_select;
267 return old_select;
268}
269
270/**
271 * Gets the select function currently used in the scheduler.
272 *
273 * @return currently used select function
274 */
275GNUNET_SCHEDULER_select
276GNUNET_SCHEDULER_get_select ()
277{
278 return scheduler_select;
279}
280
281/**
249 * Check that the given priority is legal (and return it). 282 * Check that the given priority is legal (and return it).
250 * 283 *
251 * @param p priority value to check 284 * @param p priority value to check
@@ -806,7 +839,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls)
806 /* no blocking, more work already ready! */ 839 /* no blocking, more work already ready! */
807 timeout = GNUNET_TIME_UNIT_ZERO; 840 timeout = GNUNET_TIME_UNIT_ZERO;
808 } 841 }
809 ret = GNUNET_NETWORK_socket_select (rs, ws, NULL, timeout); 842 ret = scheduler_select (rs, ws, NULL, timeout);
810 if (ret == GNUNET_SYSERR) 843 if (ret == GNUNET_SYSERR)
811 { 844 {
812 if (errno == EINTR) 845 if (errno == EINTR)