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-tests/ats-testing-experiment.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-tests/ats-testing-experiment.c')
-rw-r--r-- | src/ats-tests/ats-testing-experiment.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c index b07d8fdcd..05c27cbc4 100644 --- a/src/ats-tests/ats-testing-experiment.c +++ b/src/ats-tests/ats-testing-experiment.c | |||
@@ -420,13 +420,13 @@ static void | |||
420 | timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) | 420 | timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) |
421 | { | 421 | { |
422 | struct Experiment *e = cls; | 422 | struct Experiment *e = cls; |
423 | e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 423 | e->experiment_timeout_task = NULL; |
424 | fprintf (stderr, "Experiment timeout!\n"); | 424 | fprintf (stderr, "Experiment timeout!\n"); |
425 | 425 | ||
426 | if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) | 426 | if (NULL != e->episode_timeout_task) |
427 | { | 427 | { |
428 | GNUNET_SCHEDULER_cancel (e->episode_timeout_task); | 428 | GNUNET_SCHEDULER_cancel (e->episode_timeout_task); |
429 | e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 429 | e->episode_timeout_task = NULL; |
430 | } | 430 | } |
431 | 431 | ||
432 | e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), | 432 | e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), |
@@ -578,7 +578,7 @@ static void | |||
578 | timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) | 578 | timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) |
579 | { | 579 | { |
580 | struct Experiment *e = cls; | 580 | struct Experiment *e = cls; |
581 | e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 581 | e->episode_timeout_task = NULL; |
582 | if (NULL != e->ep_done_cb) | 582 | if (NULL != e->ep_done_cb) |
583 | e->ep_done_cb (e->cur); | 583 | e->ep_done_cb (e->cur); |
584 | 584 | ||
@@ -588,10 +588,10 @@ timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) | |||
588 | { | 588 | { |
589 | /* done */ | 589 | /* done */ |
590 | fprintf (stderr, "Last episode done!\n"); | 590 | fprintf (stderr, "Last episode done!\n"); |
591 | if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) | 591 | if (NULL != e->experiment_timeout_task) |
592 | { | 592 | { |
593 | GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); | 593 | GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); |
594 | e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 594 | e->experiment_timeout_task = NULL; |
595 | } | 595 | } |
596 | e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), GNUNET_OK); | 596 | e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), GNUNET_OK); |
597 | return; | 597 | return; |
@@ -728,15 +728,15 @@ GNUNET_ATS_TEST_experimentation_load (char *filename) | |||
728 | void | 728 | void |
729 | GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e) | 729 | GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e) |
730 | { | 730 | { |
731 | if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) | 731 | if (NULL != e->experiment_timeout_task) |
732 | { | 732 | { |
733 | GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); | 733 | GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); |
734 | e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 734 | e->experiment_timeout_task = NULL; |
735 | } | 735 | } |
736 | if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) | 736 | if (NULL != e->episode_timeout_task) |
737 | { | 737 | { |
738 | GNUNET_SCHEDULER_cancel (e->episode_timeout_task); | 738 | GNUNET_SCHEDULER_cancel (e->episode_timeout_task); |
739 | e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 739 | e->episode_timeout_task = NULL; |
740 | } | 740 | } |
741 | free_experiment (e); | 741 | free_experiment (e); |
742 | } | 742 | } |