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/testing | |
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/testing')
-rw-r--r-- | src/testing/gnunet-testing.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index a79e836c7..2db2fd737 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c | |||
@@ -76,7 +76,7 @@ static char *tmpfilename; | |||
76 | /** | 76 | /** |
77 | * Task identifier of the task that waits for stdin. | 77 | * Task identifier of the task that waits for stdin. |
78 | */ | 78 | */ |
79 | static GNUNET_SCHEDULER_TaskIdentifier tid; | 79 | static struct GNUNET_SCHEDULER_Task * tid; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Peer started for '-r'. | 82 | * Peer started for '-r'. |
@@ -207,10 +207,10 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
207 | if (0 != UNLINK (tmpfilename)) | 207 | if (0 != UNLINK (tmpfilename)) |
208 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", tmpfilename); | 208 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", tmpfilename); |
209 | } | 209 | } |
210 | if (GNUNET_SCHEDULER_NO_TASK != tid) | 210 | if (NULL != tid) |
211 | { | 211 | { |
212 | GNUNET_SCHEDULER_cancel (tid); | 212 | GNUNET_SCHEDULER_cancel (tid); |
213 | tid = GNUNET_SCHEDULER_NO_TASK; | 213 | tid = NULL; |
214 | } | 214 | } |
215 | if (NULL != fh) | 215 | if (NULL != fh) |
216 | { | 216 | { |
@@ -231,7 +231,7 @@ stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
231 | { | 231 | { |
232 | int c; | 232 | int c; |
233 | 233 | ||
234 | tid = GNUNET_SCHEDULER_NO_TASK; | 234 | tid = NULL; |
235 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 235 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
236 | return; | 236 | return; |
237 | GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)); | 237 | GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)); |