mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
loop: remove destroy list
Now that sources can't be dispatched anymore after a _remove, we don't need to keep the destroy_list anymore and we can free the source immediately. See #2114
This commit is contained in:
parent
45d911641b
commit
c474846c42
1 changed files with 1 additions and 16 deletions
|
|
@ -75,7 +75,6 @@ struct impl {
|
|||
struct spa_system *system;
|
||||
|
||||
struct spa_list source_list;
|
||||
struct spa_list destroy_list;
|
||||
struct spa_hook_list hooks_list;
|
||||
|
||||
int poll_fd;
|
||||
|
|
@ -309,14 +308,6 @@ static void loop_leave(void *object)
|
|||
impl->thread = 0;
|
||||
}
|
||||
|
||||
static inline void process_destroy(struct impl *impl)
|
||||
{
|
||||
struct source_impl *source, *tmp;
|
||||
spa_list_for_each_safe(source, tmp, &impl->destroy_list, link)
|
||||
free(source);
|
||||
spa_list_init(&impl->destroy_list);
|
||||
}
|
||||
|
||||
static int loop_iterate(void *object, int timeout)
|
||||
{
|
||||
struct impl *impl = object;
|
||||
|
|
@ -346,9 +337,6 @@ static int loop_iterate(void *object, int timeout)
|
|||
if (SPA_LIKELY(s && s->rmask))
|
||||
s->func(s);
|
||||
}
|
||||
if (SPA_UNLIKELY(!spa_list_is_empty(&impl->destroy_list)))
|
||||
process_destroy(impl);
|
||||
|
||||
impl->n_dispatching = 0;
|
||||
return nfds;
|
||||
}
|
||||
|
|
@ -703,7 +691,7 @@ static void loop_destroy_source(void *object, struct spa_source *source)
|
|||
spa_system_close(impl->impl->system, source->fd);
|
||||
source->fd = -1;
|
||||
}
|
||||
spa_list_insert(&impl->impl->destroy_list, &impl->link);
|
||||
free(source);
|
||||
}
|
||||
|
||||
static const struct spa_loop_methods impl_loop = {
|
||||
|
|
@ -770,8 +758,6 @@ static int impl_clear(struct spa_handle *handle)
|
|||
spa_list_consume(source, &impl->source_list, link)
|
||||
loop_destroy_source(impl, &source->source);
|
||||
|
||||
process_destroy(impl);
|
||||
|
||||
spa_system_close(impl->system, impl->ack_fd);
|
||||
spa_system_close(impl->system, impl->poll_fd);
|
||||
|
||||
|
|
@ -833,7 +819,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
impl->poll_fd = res;
|
||||
|
||||
spa_list_init(&impl->source_list);
|
||||
spa_list_init(&impl->destroy_list);
|
||||
spa_hook_list_init(&impl->hooks_list);
|
||||
|
||||
impl->buffer_data = SPA_PTR_ALIGN(impl->buffer_mem, MAX_ALIGN, uint8_t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue