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.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 23f683808..5b90d7e4f 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -1,10 +1,10 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2009, 2011 Christian Grothoff (and other contributing authors) 3 (C) 2009-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
@@ -300,7 +300,7 @@ update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws,
300 if (pos != NULL) 300 if (pos != NULL)
301 { 301 {
302 to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); 302 to = GNUNET_TIME_absolute_get_difference (now, pos->timeout);
303 if (timeout->rel_value > to.rel_value) 303 if (timeout->rel_value_us > to.rel_value_us)
304 *timeout = to; 304 *timeout = to;
305 if (pos->reason != 0) 305 if (pos->reason != 0)
306 *timeout = GNUNET_TIME_UNIT_ZERO; 306 *timeout = GNUNET_TIME_UNIT_ZERO;
@@ -308,10 +308,10 @@ update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws,
308 pos = pending; 308 pos = pending;
309 while (pos != NULL) 309 while (pos != NULL)
310 { 310 {
311 if (pos->timeout.abs_value != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) 311 if (pos->timeout.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us)
312 { 312 {
313 to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); 313 to = GNUNET_TIME_absolute_get_difference (now, pos->timeout);
314 if (timeout->rel_value > to.rel_value) 314 if (timeout->rel_value_us > to.rel_value_us)
315 *timeout = to; 315 *timeout = to;
316 } 316 }
317 if (pos->read_fd != -1) 317 if (pos->read_fd != -1)
@@ -373,7 +373,7 @@ is_ready (struct Task *task, struct GNUNET_TIME_Absolute now,
373 enum GNUNET_SCHEDULER_Reason reason; 373 enum GNUNET_SCHEDULER_Reason reason;
374 374
375 reason = task->reason; 375 reason = task->reason;
376 if (now.abs_value >= task->timeout.abs_value) 376 if (now.abs_value_us >= task->timeout.abs_value_us)
377 reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; 377 reason |= GNUNET_SCHEDULER_REASON_TIMEOUT;
378 if ((0 == (reason & GNUNET_SCHEDULER_REASON_READ_READY)) && 378 if ((0 == (reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
379 (((task->read_fd != -1) && 379 (((task->read_fd != -1) &&
@@ -433,7 +433,7 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs,
433 while (pos != NULL) 433 while (pos != NULL)
434 { 434 {
435 next = pos->next; 435 next = pos->next;
436 if (now.abs_value >= pos->timeout.abs_value) 436 if (now.abs_value_us >= pos->timeout.abs_value_us)
437 pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; 437 pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT;
438 if (0 == pos->reason) 438 if (0 == pos->reason)
439 break; 439 break;
@@ -569,8 +569,8 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
569 current_lifeness = pos->lifeness; 569 current_lifeness = pos->lifeness;
570 active_task = pos; 570 active_task = pos;
571#if PROFILE_DELAYS 571#if PROFILE_DELAYS
572 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value > 572 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us >
573 DELAY_THRESHOLD.rel_value) 573 DELAY_THRESHOLD.rel_value_us)
574 { 574 {
575 LOG (GNUNET_ERROR_TYPE_DEBUG, 575 LOG (GNUNET_ERROR_TYPE_DEBUG,
576 "Task %llu took %s to be scheduled\n", 576 "Task %llu took %s to be scheduled\n",
@@ -777,7 +777,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls)
777 GNUNET_abort (); 777 GNUNET_abort ();
778 break; 778 break;
779 } 779 }
780 if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16)) 780 if ((0 == ret) && (0 == timeout.rel_value_us) && (busy_wait_warning > 16))
781 { 781 {
782 LOG (GNUNET_ERROR_TYPE_WARNING, _("Looks like we're busy waiting...\n")); 782 LOG (GNUNET_ERROR_TYPE_WARNING, _("Looks like we're busy waiting...\n"));
783 sleep (1); /* mitigate */ 783 sleep (1); /* mitigate */
@@ -1091,7 +1091,7 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay,
1091 prev = pending_timeout_last; 1091 prev = pending_timeout_last;
1092 if (prev != NULL) 1092 if (prev != NULL)
1093 { 1093 {
1094 if (prev->timeout.abs_value > t->timeout.abs_value) 1094 if (prev->timeout.abs_value_us > t->timeout.abs_value_us)
1095 prev = NULL; 1095 prev = NULL;
1096 else 1096 else
1097 pos = prev->next; /* heuristic success! */ 1097 pos = prev->next; /* heuristic success! */
@@ -1102,8 +1102,8 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay,
1102 pos = pending_timeout; 1102 pos = pending_timeout;
1103 } 1103 }
1104 while ((pos != NULL) && 1104 while ((pos != NULL) &&
1105 ((pos->timeout.abs_value <= t->timeout.abs_value) || 1105 ((pos->timeout.abs_value_us <= t->timeout.abs_value_us) ||
1106 (pos->reason != 0))) 1106 (0 != pos->reason)))
1107 { 1107 {
1108 prev = pos; 1108 prev = pos;
1109 pos = pos->next; 1109 pos = pos->next;