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/fs/gnunet-daemon-fsprofiler.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/fs/gnunet-daemon-fsprofiler.c') diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c index 1549972a1..9c4f28351 100644 --- a/src/fs/gnunet-daemon-fsprofiler.c +++ b/src/fs/gnunet-daemon-fsprofiler.c @@ -69,12 +69,12 @@ struct Pattern /** * Task to run the operation. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Secondary task to run the operation. */ - GNUNET_SCHEDULER_TaskIdentifier stask; + struct GNUNET_SCHEDULER_Task * stask; /** * X-value. @@ -276,7 +276,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) while (NULL != (p = publish_head)) { - if (GNUNET_SCHEDULER_NO_TASK != p->task) + if (NULL != p->task) GNUNET_SCHEDULER_cancel (p->task); if (NULL != p->ctx) GNUNET_FS_publish_stop (p->ctx); @@ -285,9 +285,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } while (NULL != (p = download_head)) { - if (GNUNET_SCHEDULER_NO_TASK != p->task) + if (NULL != p->task) GNUNET_SCHEDULER_cancel (p->task); - if (GNUNET_SCHEDULER_NO_TASK != p->stask) + if (NULL != p->stask) GNUNET_SCHEDULER_cancel (p->stask); if (NULL != p->ctx) GNUNET_FS_download_stop (p->ctx, GNUNET_YES); @@ -320,7 +320,7 @@ publish_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Pattern *p = cls; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; GNUNET_FS_publish_stop (p->ctx); } @@ -336,7 +336,7 @@ download_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Pattern *p = cls; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; GNUNET_FS_download_stop (p->ctx, GNUNET_YES); } @@ -352,7 +352,7 @@ search_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Pattern *p = cls; - p->stask = GNUNET_SCHEDULER_NO_TASK; + p->stask = NULL; GNUNET_FS_search_stop (p->sctx); } @@ -507,7 +507,7 @@ start_publish (void *cls, struct Pattern *p = cls; struct GNUNET_FS_FileInformation *fi; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; fi = make_file (p->x, p->y, p); @@ -532,7 +532,7 @@ start_download (void *cls, struct Pattern *p = cls; struct GNUNET_FS_Uri *keywords; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; keywords = make_keywords (p->x); -- cgit v1.2.3