diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-04-19 12:07:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-04-19 12:07:05 +0000 |
commit | b272a833ee57cad630ecbcce1aab366777042dd9 (patch) | |
tree | 9a6057f81afe36db736b4911a85c0b94538c1f53 /src/util/scheduler.c | |
parent | 50c4e060fc721dfe2af9115639a4d47e88e04f00 (diff) | |
download | gnunet-b272a833ee57cad630ecbcce1aab366777042dd9.tar.gz gnunet-b272a833ee57cad630ecbcce1aab366777042dd9.zip |
-fixing #2274 -- eliminating GNUNET_SCHEDULER_add_after
Diffstat (limited to 'src/util/scheduler.c')
-rw-r--r-- | src/util/scheduler.c | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index c54672f5f..8d3106032 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -1107,31 +1107,6 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, | |||
1107 | 1107 | ||
1108 | 1108 | ||
1109 | /** | 1109 | /** |
1110 | * Schedule a new task to be run after the specified prerequisite task | ||
1111 | * has completed. It will be run with the DEFAULT priority. | ||
1112 | * | ||
1113 | * @param prerequisite_task run this task after the task with the given | ||
1114 | * task identifier completes (and any of our other | ||
1115 | * conditions, such as delay, read or write-readiness | ||
1116 | * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency | ||
1117 | * on completion of other tasks (this will cause the task to run as | ||
1118 | * soon as possible). | ||
1119 | * @param task main function of the task | ||
1120 | * @param task_cls closure of task | ||
1121 | * @return unique task identifier for the job | ||
1122 | * only valid until "task" is started! | ||
1123 | */ | ||
1124 | GNUNET_SCHEDULER_TaskIdentifier | ||
1125 | GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, | ||
1126 | GNUNET_SCHEDULER_Task task, void *task_cls) | ||
1127 | { | ||
1128 | return GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1129 | prerequisite_task, GNUNET_TIME_UNIT_ZERO, | ||
1130 | NULL, NULL, task, task_cls); | ||
1131 | } | ||
1132 | |||
1133 | |||
1134 | /** | ||
1135 | * Schedule a new task to be run with a specified priority. | 1110 | * Schedule a new task to be run with a specified priority. |
1136 | * | 1111 | * |
1137 | * @param prio how important is the new task? | 1112 | * @param prio how important is the new task? |
@@ -1144,7 +1119,7 @@ GNUNET_SCHEDULER_TaskIdentifier | |||
1144 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | 1119 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, |
1145 | GNUNET_SCHEDULER_Task task, void *task_cls) | 1120 | GNUNET_SCHEDULER_Task task, void *task_cls) |
1146 | { | 1121 | { |
1147 | return GNUNET_SCHEDULER_add_select (prio, GNUNET_SCHEDULER_NO_TASK, | 1122 | return GNUNET_SCHEDULER_add_select (prio, |
1148 | GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, | 1123 | GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, |
1149 | task_cls); | 1124 | task_cls); |
1150 | } | 1125 | } |
@@ -1299,7 +1274,6 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | |||
1299 | 1274 | ||
1300 | ret = | 1275 | ret = |
1301 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1276 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1302 | GNUNET_SCHEDULER_NO_TASK, | ||
1303 | GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, | 1277 | GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, |
1304 | task_cls); | 1278 | task_cls); |
1305 | GNUNET_assert (pending->id == ret); | 1279 | GNUNET_assert (pending->id == ret); |
@@ -1450,7 +1424,7 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |||
1450 | GNUNET_NETWORK_fdset_set (rs, rfd); | 1424 | GNUNET_NETWORK_fdset_set (rs, rfd); |
1451 | ret = | 1425 | ret = |
1452 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1426 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1453 | GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL, | 1427 | delay, rs, NULL, |
1454 | task, task_cls); | 1428 | task, task_cls); |
1455 | GNUNET_NETWORK_fdset_destroy (rs); | 1429 | GNUNET_NETWORK_fdset_destroy (rs); |
1456 | return ret; | 1430 | return ret; |
@@ -1493,7 +1467,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | |||
1493 | GNUNET_NETWORK_fdset_set (ws, wfd); | 1467 | GNUNET_NETWORK_fdset_set (ws, wfd); |
1494 | ret = | 1468 | ret = |
1495 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1469 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1496 | GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws, | 1470 | delay, NULL, ws, |
1497 | task, task_cls); | 1471 | task, task_cls); |
1498 | GNUNET_NETWORK_fdset_destroy (ws); | 1472 | GNUNET_NETWORK_fdset_destroy (ws); |
1499 | return ret; | 1473 | return ret; |
@@ -1536,7 +1510,7 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | |||
1536 | GNUNET_NETWORK_fdset_handle_set (rs, rfd); | 1510 | GNUNET_NETWORK_fdset_handle_set (rs, rfd); |
1537 | ret = | 1511 | ret = |
1538 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1512 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1539 | GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL, | 1513 | delay, rs, NULL, |
1540 | task, task_cls); | 1514 | task, task_cls); |
1541 | GNUNET_NETWORK_fdset_destroy (rs); | 1515 | GNUNET_NETWORK_fdset_destroy (rs); |
1542 | return ret; | 1516 | return ret; |
@@ -1581,7 +1555,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | |||
1581 | GNUNET_NETWORK_fdset_handle_set (ws, wfd); | 1555 | GNUNET_NETWORK_fdset_handle_set (ws, wfd); |
1582 | ret = | 1556 | ret = |
1583 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1557 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1584 | GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws, | 1558 | delay, NULL, ws, |
1585 | task, task_cls); | 1559 | task, task_cls); |
1586 | GNUNET_NETWORK_fdset_destroy (ws); | 1560 | GNUNET_NETWORK_fdset_destroy (ws); |
1587 | return ret; | 1561 | return ret; |
@@ -1617,11 +1591,6 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | |||
1617 | * </code> | 1591 | * </code> |
1618 | * | 1592 | * |
1619 | * @param prio how important is this task? | 1593 | * @param prio how important is this task? |
1620 | * @param prerequisite_task run this task after the task with the given | ||
1621 | * task identifier completes (and any of our other | ||
1622 | * conditions, such as delay, read or write-readiness | ||
1623 | * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency | ||
1624 | * on completion of other tasks. | ||
1625 | * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever", | 1594 | * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever", |
1626 | * which means that the task will only be run after we receive SIGTERM | 1595 | * which means that the task will only be run after we receive SIGTERM |
1627 | * @param rs set of file descriptors we want to read (can be NULL) | 1596 | * @param rs set of file descriptors we want to read (can be NULL) |
@@ -1633,7 +1602,6 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | |||
1633 | */ | 1602 | */ |
1634 | GNUNET_SCHEDULER_TaskIdentifier | 1603 | GNUNET_SCHEDULER_TaskIdentifier |
1635 | GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | 1604 | GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, |
1636 | GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, | ||
1637 | struct GNUNET_TIME_Relative delay, | 1605 | struct GNUNET_TIME_Relative delay, |
1638 | const struct GNUNET_NETWORK_FDSet *rs, | 1606 | const struct GNUNET_NETWORK_FDSet *rs, |
1639 | const struct GNUNET_NETWORK_FDSet *ws, | 1607 | const struct GNUNET_NETWORK_FDSet *ws, |
@@ -1671,7 +1639,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
1671 | #if PROFILE_DELAYS | 1639 | #if PROFILE_DELAYS |
1672 | t->start_time = GNUNET_TIME_absolute_get (); | 1640 | t->start_time = GNUNET_TIME_absolute_get (); |
1673 | #endif | 1641 | #endif |
1674 | t->prereq_id = prerequisite_task; | ||
1675 | t->timeout = GNUNET_TIME_relative_to_absolute (delay); | 1642 | t->timeout = GNUNET_TIME_relative_to_absolute (delay); |
1676 | t->priority = | 1643 | t->priority = |
1677 | check_priority ((prio == | 1644 | check_priority ((prio == |