diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-27 21:10:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-27 21:10:58 +0000 |
commit | 0e95912060c3c460353fc63c0bcec84f699c5bd8 (patch) | |
tree | 497f64d7d8a159e317c8ddc117ec5435aeac83ed /src/util/scheduler.c | |
parent | 2845137368226d8b35c8d4e6d455810a61b87764 (diff) | |
download | gnunet-0e95912060c3c460353fc63c0bcec84f699c5bd8.tar.gz gnunet-0e95912060c3c460353fc63c0bcec84f699c5bd8.zip |
adding GNUNET_SCHEDULER_add_read_net_with_priority
Diffstat (limited to 'src/util/scheduler.c')
-rw-r--r-- | src/util/scheduler.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 6b8d21443..140692362 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -1334,6 +1334,34 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |||
1334 | struct GNUNET_NETWORK_Handle *rfd, | 1334 | struct GNUNET_NETWORK_Handle *rfd, |
1335 | GNUNET_SCHEDULER_Task task, void *task_cls) | 1335 | GNUNET_SCHEDULER_Task task, void *task_cls) |
1336 | { | 1336 | { |
1337 | return GNUNET_SCHEDULER_add_read_net_with_priority (delay, | ||
1338 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1339 | rfd, task, task_cls); | ||
1340 | } | ||
1341 | |||
1342 | |||
1343 | /** | ||
1344 | * Schedule a new task to be run with a specified priority and to be | ||
1345 | * run after the specified delay or when the specified file descriptor | ||
1346 | * is ready for reading. The delay can be used as a timeout on the | ||
1347 | * socket being ready. The task will be scheduled for execution once | ||
1348 | * either the delay has expired or the socket operation is ready. It | ||
1349 | * will be run with the DEFAULT priority. | ||
1350 | * | ||
1351 | * * @param delay when should this operation time out? Use | ||
1352 | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | ||
1353 | * @param rfd read file-descriptor | ||
1354 | * @param task main function of the task | ||
1355 | * @param task_cls closure of task | ||
1356 | * @return unique task identifier for the job | ||
1357 | * only valid until "task" is started! | ||
1358 | */ | ||
1359 | GNUNET_SCHEDULER_TaskIdentifier | ||
1360 | GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, | ||
1361 | enum GNUNET_SCHEDULER_Priority priority, | ||
1362 | struct GNUNET_NETWORK_Handle *rfd, | ||
1363 | GNUNET_SCHEDULER_Task task, void *task_cls) | ||
1364 | { | ||
1337 | #if MINGW | 1365 | #if MINGW |
1338 | struct GNUNET_NETWORK_FDSet *rs; | 1366 | struct GNUNET_NETWORK_FDSet *rs; |
1339 | GNUNET_SCHEDULER_TaskIdentifier ret; | 1367 | GNUNET_SCHEDULER_TaskIdentifier ret; |
@@ -1342,20 +1370,21 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |||
1342 | rs = GNUNET_NETWORK_fdset_create (); | 1370 | rs = GNUNET_NETWORK_fdset_create (); |
1343 | GNUNET_NETWORK_fdset_set (rs, rfd); | 1371 | GNUNET_NETWORK_fdset_set (rs, rfd); |
1344 | ret = | 1372 | ret = |
1345 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1373 | GNUNET_SCHEDULER_add_select (priority, |
1346 | delay, rs, NULL, | 1374 | delay, rs, NULL, |
1347 | task, task_cls); | 1375 | task, task_cls); |
1348 | GNUNET_NETWORK_fdset_destroy (rs); | 1376 | GNUNET_NETWORK_fdset_destroy (rs); |
1349 | return ret; | 1377 | return ret; |
1350 | #else | 1378 | #else |
1351 | return add_without_sets (delay, | 1379 | return add_without_sets (delay, |
1352 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1380 | priority, |
1353 | GNUNET_NETWORK_get_fd (rfd), -1, task, | 1381 | GNUNET_NETWORK_get_fd (rfd), -1, task, |
1354 | task_cls); | 1382 | task_cls); |
1355 | #endif | 1383 | #endif |
1356 | } | 1384 | } |
1357 | 1385 | ||
1358 | 1386 | ||
1387 | |||
1359 | /** | 1388 | /** |
1360 | * Schedule a new task to be run with a specified delay or when the | 1389 | * Schedule a new task to be run with a specified delay or when the |
1361 | * specified file descriptor is ready for writing. The delay can be | 1390 | * specified file descriptor is ready for writing. The delay can be |