diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
commit | f1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch) | |
tree | 3a29966b02dfb83e0a8a8d5c42b3116380209fb0 /src/ats/plugin_ats_ril.c | |
parent | 53cd5b8eda2fa8db86b0907a62a39598981d008a (diff) | |
download | gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.tar.gz gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.zip |
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/ats/plugin_ats_ril.c')
-rw-r--r-- | src/ats/plugin_ats_ril.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index 4feb0fd9a..c87876ea1 100644 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c | |||
@@ -412,7 +412,7 @@ struct GAS_RIL_Handle | |||
412 | /** | 412 | /** |
413 | * Task identifier of the next time-step to be executed | 413 | * Task identifier of the next time-step to be executed |
414 | */ | 414 | */ |
415 | GNUNET_SCHEDULER_TaskIdentifier step_next_task_id; | 415 | struct GNUNET_SCHEDULER_Task * step_next_task_id; |
416 | 416 | ||
417 | /** | 417 | /** |
418 | * Variable discount factor, dependent on time between steps | 418 | * Variable discount factor, dependent on time between steps |
@@ -1546,7 +1546,7 @@ ril_step_scheduler_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t | |||
1546 | { | 1546 | { |
1547 | struct GAS_RIL_Handle *solver = cls; | 1547 | struct GAS_RIL_Handle *solver = cls; |
1548 | 1548 | ||
1549 | solver->step_next_task_id = GNUNET_SCHEDULER_NO_TASK; | 1549 | solver->step_next_task_id = NULL; |
1550 | ril_step (solver); | 1550 | ril_step (solver); |
1551 | } | 1551 | } |
1552 | 1552 | ||
@@ -1875,7 +1875,7 @@ ril_step_schedule_next (struct GAS_RIL_Handle *solver) | |||
1875 | time_next = GNUNET_TIME_UNIT_ZERO; | 1875 | time_next = GNUNET_TIME_UNIT_ZERO; |
1876 | } | 1876 | } |
1877 | 1877 | ||
1878 | if ((GNUNET_SCHEDULER_NO_TASK == solver->step_next_task_id) && (GNUNET_NO == solver->done)) | 1878 | if ((NULL == solver->step_next_task_id) && (GNUNET_NO == solver->done)) |
1879 | { | 1879 | { |
1880 | solver->step_next_task_id = GNUNET_SCHEDULER_add_delayed (time_next, &ril_step_scheduler_task, | 1880 | solver->step_next_task_id = GNUNET_SCHEDULER_add_delayed (time_next, &ril_step_scheduler_task, |
1881 | solver); | 1881 | solver); |
@@ -2939,7 +2939,7 @@ libgnunet_plugin_ats_ril_done (void *cls) | |||
2939 | cur_agent = next_agent; | 2939 | cur_agent = next_agent; |
2940 | } | 2940 | } |
2941 | 2941 | ||
2942 | if (GNUNET_SCHEDULER_NO_TASK != s->step_next_task_id) | 2942 | if (NULL != s->step_next_task_id) |
2943 | { | 2943 | { |
2944 | GNUNET_SCHEDULER_cancel (s->step_next_task_id); | 2944 | GNUNET_SCHEDULER_cancel (s->step_next_task_id); |
2945 | } | 2945 | } |