diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-14 11:12:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-14 11:12:46 +0000 |
commit | a2ed50e8e82e1d4f60302c30f9d748f7698b7cec (patch) | |
tree | 223239f9e17b485924c8cd52b8bd55f657061d7b /src/util | |
parent | 53da062e08f1d1d4392b3a40396bb45cc093e2ac (diff) | |
download | gnunet-a2ed50e8e82e1d4f60302c30f9d748f7698b7cec.tar.gz gnunet-a2ed50e8e82e1d4f60302c30f9d748f7698b7cec.zip |
remove getter, make global static, add closure argument
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/disk.h | 2 | ||||
-rw-r--r-- | src/util/scheduler.c | 38 |
2 files changed, 18 insertions, 22 deletions
diff --git a/src/util/disk.h b/src/util/disk.h index fee43abb8..0f094e289 100644 --- a/src/util/disk.h +++ b/src/util/disk.h | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #include "gnunet_disk_lib.h" | 29 | #include "gnunet_disk_lib.h" |
30 | 30 | ||
31 | }; | ||
32 | |||
33 | /** | 31 | /** |
34 | * Retrieve OS file handle | 32 | * Retrieve OS file handle |
35 | * | 33 | * |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 692c4f0b7..d7f9a293b 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -247,36 +247,29 @@ static int current_lifeness; | |||
247 | 247 | ||
248 | /** | 248 | /** |
249 | * Function to use as a select() in the scheduler. | 249 | * Function to use as a select() in the scheduler. |
250 | * Defaults to GNUNET_NETWORK_socket_select () | 250 | * If NULL, we use GNUNET_NETWORK_socket_select (). |
251 | */ | 251 | */ |
252 | GNUNET_SCHEDULER_select scheduler_select = GNUNET_NETWORK_socket_select; | 252 | static GNUNET_SCHEDULER_select scheduler_select; |
253 | |||
254 | /** | ||
255 | * Closure for 'scheduler_select'. | ||
256 | */ | ||
257 | static void *scheduler_select_cls; | ||
253 | 258 | ||
254 | /** | 259 | /** |
255 | * Sets the select function to use in the scheduler (scheduler_select). | 260 | * Sets the select function to use in the scheduler (scheduler_select). |
256 | * | 261 | * |
257 | * @param new_select new select function to use | 262 | * @param new_select new select function to use |
258 | * @return previously used select function | 263 | * @return previously used select function, NULL for default |
259 | */ | 264 | */ |
260 | GNUNET_SCHEDULER_select | 265 | void |
261 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select) | 266 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, |
267 | void *new_select_cls) | ||
262 | { | 268 | { |
263 | GNUNET_SCHEDULER_select old_select = scheduler_select; | ||
264 | scheduler_select = new_select; | 269 | scheduler_select = new_select; |
265 | if (scheduler_select == NULL) | 270 | scheduler_select_cls = new_select_cls; |
266 | scheduler_select = GNUNET_NETWORK_socket_select; | ||
267 | return old_select; | ||
268 | } | 271 | } |
269 | 272 | ||
270 | /** | ||
271 | * Gets the select function currently used in the scheduler. | ||
272 | * | ||
273 | * @return currently used select function | ||
274 | */ | ||
275 | GNUNET_SCHEDULER_select | ||
276 | GNUNET_SCHEDULER_get_select () | ||
277 | { | ||
278 | return scheduler_select; | ||
279 | } | ||
280 | 273 | ||
281 | /** | 274 | /** |
282 | * Check that the given priority is legal (and return it). | 275 | * Check that the given priority is legal (and return it). |
@@ -839,7 +832,12 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) | |||
839 | /* no blocking, more work already ready! */ | 832 | /* no blocking, more work already ready! */ |
840 | timeout = GNUNET_TIME_UNIT_ZERO; | 833 | timeout = GNUNET_TIME_UNIT_ZERO; |
841 | } | 834 | } |
842 | ret = scheduler_select (rs, ws, NULL, timeout); | 835 | if (NULL == scheduler_select) |
836 | ret = GNUNET_NETWORK_socket_select (rs, ws, NULL, timeout); | ||
837 | else | ||
838 | ret = scheduler_select (scheduler_select_cls, | ||
839 | rs, ws, NULL, | ||
840 | timeout); | ||
843 | if (ret == GNUNET_SYSERR) | 841 | if (ret == GNUNET_SYSERR) |
844 | { | 842 | { |
845 | if (errno == EINTR) | 843 | if (errno == EINTR) |