From 56f8c953dd609bc5c94011fe4acdd9ef6b875747 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 19 Jun 2004 01:01:09 +0000 Subject: some more work on the cli git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@24 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/module.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/module.c') diff --git a/src/module.c b/src/module.c index 0be7f5ed..c6de1751 100644 --- a/src/module.c +++ b/src/module.c @@ -17,6 +17,9 @@ struct module* module_load(struct core *c, const char *name, const char *argumen m = malloc(sizeof(struct module)); assert(m); + m->name = strdup(name); + m->argument = argument ? strdup(argument) : NULL; + if (!(m->dl = lt_dlopenext(name))) goto fail; @@ -26,8 +29,6 @@ struct module* module_load(struct core *c, const char *name, const char *argumen if (!(m->done = lt_dlsym(m->dl, "module_done"))) goto fail; - m->name = strdup(name); - m->argument = argument ? strdup(argument) : NULL; m->userdata = NULL; m->core = c; @@ -127,3 +128,28 @@ char *module_list_to_string(struct core *c) { return strbuf_tostring_free(s); } + + +struct once_info { + struct core *core; + uint32_t index; +}; + + +void module_unload_once_callback(void *userdata) { + struct once_info *i = userdata; + assert(i); + module_unload_by_index(i->core, i->index); + free(i); +} + +void module_unload_request(struct core *c, struct module *m) { + struct once_info *i; + assert(c && m); + + i = malloc(sizeof(struct once_info)); + assert(i); + i->core = c; + i->index = m->index; + mainloop_once(c->mainloop, module_unload_once_callback, i); +} -- cgit