From f1f603c7d0b3f03dca46a4f313472288eb080eb1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 24 Dec 2014 01:10:47 +0000 Subject: making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247 --- src/ats-tests/ats-testing-experiment.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/ats-tests/ats-testing-experiment.c') diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c index b07d8fdcd6..05c27cbc48 100644 --- a/src/ats-tests/ats-testing-experiment.c +++ b/src/ats-tests/ats-testing-experiment.c @@ -420,13 +420,13 @@ static void timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; fprintf (stderr, "Experiment timeout!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), @@ -578,7 +578,7 @@ static void timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; if (NULL != e->ep_done_cb) e->ep_done_cb (e->cur); @@ -588,10 +588,10 @@ timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { /* done */ fprintf (stderr, "Last episode done!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), GNUNET_OK); return; @@ -728,15 +728,15 @@ GNUNET_ATS_TEST_experimentation_load (char *filename) void GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e) { - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } free_experiment (e); } -- cgit v1.2.3-18-g5258