diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
commit | 29e6158507a0758192075ac6ece7ba8e75ddc49a (patch) | |
tree | b91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/util/os_priority.c | |
parent | 5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff) | |
download | gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip |
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/util/os_priority.c')
-rw-r--r-- | src/util/os_priority.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 52e2f6d0e..8dfec6c5e 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -70,18 +70,19 @@ static struct GNUNET_OS_Process current_process; | |||
70 | * This handler is called when there are control data to be read on the pipe | 70 | * This handler is called when there are control data to be read on the pipe |
71 | * | 71 | * |
72 | * @param cls the 'struct GNUNET_DISK_FileHandle' of the control pipe | 72 | * @param cls the 'struct GNUNET_DISK_FileHandle' of the control pipe |
73 | * @param tc scheduler context | ||
74 | */ | 73 | */ |
75 | static void | 74 | static void |
76 | parent_control_handler (void *cls, | 75 | parent_control_handler (void *cls) |
77 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
78 | { | 76 | { |
79 | struct GNUNET_DISK_FileHandle *control_pipe = cls; | 77 | struct GNUNET_DISK_FileHandle *control_pipe = cls; |
78 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
80 | char sig; | 79 | char sig; |
81 | char *pipe_fd; | 80 | char *pipe_fd; |
82 | ssize_t ret; | 81 | ssize_t ret; |
83 | 82 | ||
84 | LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, | 83 | tc = GNUNET_SCHEDULER_get_task_context (); |
84 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
85 | "`%s' invoked because of %d\n", __FUNCTION__, | ||
85 | tc->reason); | 86 | tc->reason); |
86 | if (0 != (tc->reason & | 87 | if (0 != (tc->reason & |
87 | (GNUNET_SCHEDULER_REASON_SHUTDOWN | GNUNET_SCHEDULER_REASON_TIMEOUT))) | 88 | (GNUNET_SCHEDULER_REASON_SHUTDOWN | GNUNET_SCHEDULER_REASON_TIMEOUT))) |
@@ -118,12 +119,9 @@ parent_control_handler (void *cls, | |||
118 | * variable) and raise those signals. | 119 | * variable) and raise those signals. |
119 | * | 120 | * |
120 | * @param cls closure (unused) | 121 | * @param cls closure (unused) |
121 | * @param tc scheduler context (unused) | ||
122 | */ | 122 | */ |
123 | void | 123 | void |
124 | GNUNET_OS_install_parent_control_handler (void *cls, | 124 | GNUNET_OS_install_parent_control_handler (void *cls) |
125 | const struct | ||
126 | GNUNET_SCHEDULER_TaskContext *tc) | ||
127 | { | 125 | { |
128 | const char *env_buf; | 126 | const char *env_buf; |
129 | char *env_buf_end; | 127 | char *env_buf_end; |
@@ -1751,18 +1749,19 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd) | |||
1751 | /** | 1749 | /** |
1752 | * Read from the process and call the line processor. | 1750 | * Read from the process and call the line processor. |
1753 | * | 1751 | * |
1754 | * @param cls the 'struct GNUNET_OS_CommandHandle' | 1752 | * @param cls the `struct GNUNET_OS_CommandHandle *` |
1755 | * @param tc scheduler context | ||
1756 | */ | 1753 | */ |
1757 | static void | 1754 | static void |
1758 | cmd_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1755 | cmd_read (void *cls) |
1759 | { | 1756 | { |
1760 | struct GNUNET_OS_CommandHandle *cmd = cls; | 1757 | struct GNUNET_OS_CommandHandle *cmd = cls; |
1758 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
1761 | GNUNET_OS_LineProcessor proc; | 1759 | GNUNET_OS_LineProcessor proc; |
1762 | char *end; | 1760 | char *end; |
1763 | ssize_t ret; | 1761 | ssize_t ret; |
1764 | 1762 | ||
1765 | cmd->rtask = NULL; | 1763 | cmd->rtask = NULL; |
1764 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
1766 | if (GNUNET_YES != GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, cmd->r)) | 1765 | if (GNUNET_YES != GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, cmd->r)) |
1767 | { | 1766 | { |
1768 | /* timeout, shutdown, etc. */ | 1767 | /* timeout, shutdown, etc. */ |