module: remove module_run_context

Store abort_fd directly in the module struct instead. This then allows
us to pass the module pointer as-is to the modules' run functions.
This commit is contained in:
Daniel Eklöf 2019-01-13 15:34:59 +01:00
parent acdeff3b6e
commit 76d135e257
13 changed files with 57 additions and 77 deletions

View file

@ -258,9 +258,8 @@ update_status(struct module *mod)
}
static int
run(struct module_run_context *ctx)
run(struct module *mod)
{
struct module *mod = ctx->module;
const struct bar *bar = mod->bar;
struct private *m = mod->private;
@ -289,7 +288,7 @@ run(struct module_run_context *ctx)
if (m->conn != NULL)
break;
struct pollfd fds[] = {{.fd = ctx->abort_fd, .events = POLLIN}};
struct pollfd fds[] = {{.fd = mod->abort_fd, .events = POLLIN}};
int res = poll(fds, 1, 10 * 1000);
if (res == 1) {
@ -311,7 +310,7 @@ run(struct module_run_context *ctx)
/* Monitor for events from MPD */
while (true) {
struct pollfd fds[] = {
{.fd = ctx->abort_fd, .events = POLLIN},
{.fd = mod->abort_fd, .events = POLLIN},
{.fd = mpd_connection_get_fd(m->conn), .events = POLLIN},
};