mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse-server: use the work-queue to unload modules
This avoids allocating an eventfd for each module.
This commit is contained in:
parent
fee8bf69dd
commit
639e6ea644
2 changed files with 5 additions and 8 deletions
|
|
@ -27,16 +27,16 @@
|
||||||
|
|
||||||
static int module_unload(struct client *client, struct module *module);
|
static int module_unload(struct client *client, struct module *module);
|
||||||
|
|
||||||
static void on_module_unload(void *data, uint64_t count)
|
static void on_module_unload(void *obj, void *data, int res, uint32_t id)
|
||||||
{
|
{
|
||||||
struct module *module = data;
|
struct module *module = obj;
|
||||||
|
|
||||||
module_unload(NULL, module);
|
module_unload(NULL, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
void module_schedule_unload(struct module *module)
|
void module_schedule_unload(struct module *module)
|
||||||
{
|
{
|
||||||
pw_loop_signal_event(module->impl->loop, module->unload);
|
struct impl *impl = module->impl;
|
||||||
|
pw_work_queue_add(impl->work_queue, module, 0, on_module_unload, impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data)
|
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data)
|
||||||
|
|
@ -50,7 +50,6 @@ struct module *module_new(struct impl *impl, const struct module_methods *method
|
||||||
module->impl = impl;
|
module->impl = impl;
|
||||||
module->methods = methods;
|
module->methods = methods;
|
||||||
spa_hook_list_init(&module->hooks);
|
spa_hook_list_init(&module->hooks);
|
||||||
module->unload = pw_loop_add_event(impl->loop, on_module_unload, module);
|
|
||||||
module->user_data = SPA_MEMBER(module, sizeof(struct module), void);
|
module->user_data = SPA_MEMBER(module, sizeof(struct module), void);
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
|
|
@ -79,12 +78,11 @@ static void module_free(struct module *module)
|
||||||
if (module->idx != SPA_ID_INVALID)
|
if (module->idx != SPA_ID_INVALID)
|
||||||
pw_map_remove(&impl->modules, module->idx & INDEX_MASK);
|
pw_map_remove(&impl->modules, module->idx & INDEX_MASK);
|
||||||
|
|
||||||
|
pw_work_queue_cancel(impl->work_queue, module, SPA_ID_INVALID);
|
||||||
free((char*)module->name);
|
free((char*)module->name);
|
||||||
free((char*)module->args);
|
free((char*)module->args);
|
||||||
if (module->props)
|
if (module->props)
|
||||||
pw_properties_free(module->props);
|
pw_properties_free(module->props);
|
||||||
pw_loop_destroy_source(impl->loop, module->unload);
|
|
||||||
|
|
||||||
free(module);
|
free(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ struct module {
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
const struct module_methods *methods;
|
const struct module_methods *methods;
|
||||||
struct spa_hook_list hooks;
|
struct spa_hook_list hooks;
|
||||||
struct spa_source *unload;
|
|
||||||
void *user_data;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue