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/testbed/gnunet-service-testbed_cpustatus.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/testbed/gnunet-service-testbed_cpustatus.c')
-rw-r--r-- | src/testbed/gnunet-service-testbed_cpustatus.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c index 712df48b3..fa0ee52c0 100644 --- a/src/testbed/gnunet-service-testbed_cpustatus.c +++ b/src/testbed/gnunet-service-testbed_cpustatus.c | |||
@@ -85,7 +85,7 @@ static double agedIOLoad = -1; | |||
85 | */ | 85 | */ |
86 | struct GNUNET_BIO_WriteHandle *bw; | 86 | struct GNUNET_BIO_WriteHandle *bw; |
87 | 87 | ||
88 | GNUNET_SCHEDULER_TaskIdentifier sample_load_task_id; | 88 | struct GNUNET_SCHEDULER_Task * sample_load_task_id; |
89 | 89 | ||
90 | 90 | ||
91 | #ifdef OSX | 91 | #ifdef OSX |
@@ -656,7 +656,7 @@ sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
656 | unsigned int mem_usage; | 656 | unsigned int mem_usage; |
657 | unsigned int nproc; | 657 | unsigned int nproc; |
658 | 658 | ||
659 | sample_load_task_id = GNUNET_SCHEDULER_NO_TASK; | 659 | sample_load_task_id = NULL; |
660 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 660 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
661 | return; | 661 | return; |
662 | ld_cpu = cpu_get_load (); | 662 | ld_cpu = cpu_get_load (); |
@@ -767,10 +767,10 @@ GST_stats_destroy () | |||
767 | #elif OSX | 767 | #elif OSX |
768 | GNUNET_free_non_null (prev_cpu_load); | 768 | GNUNET_free_non_null (prev_cpu_load); |
769 | #endif | 769 | #endif |
770 | if (GNUNET_SCHEDULER_NO_TASK != sample_load_task_id) | 770 | if (NULL != sample_load_task_id) |
771 | { | 771 | { |
772 | GNUNET_SCHEDULER_cancel (sample_load_task_id); | 772 | GNUNET_SCHEDULER_cancel (sample_load_task_id); |
773 | sample_load_task_id = GNUNET_SCHEDULER_NO_TASK; | 773 | sample_load_task_id = NULL; |
774 | } | 774 | } |
775 | GNUNET_break (GNUNET_OK == GNUNET_BIO_write_close (bw)); | 775 | GNUNET_break (GNUNET_OK == GNUNET_BIO_write_close (bw)); |
776 | bw = NULL; | 776 | bw = NULL; |