mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
loop: simplify before and after events
Because the signal can't be removed from the callback we can simply iterate backwards and then forwards. The first added hook (the unlock/lock pair) is called last before going into the poll and first when leaving. This executes all other callbacks inside a locked situation. And removing them with the lock is not going to cause problems.
This commit is contained in:
parent
854d019343
commit
e5f7e040dc
3 changed files with 28 additions and 16 deletions
|
|
@ -98,9 +98,17 @@ static inline void spa_list_remove(struct spa_list *elem)
|
|||
!spa_list_is_end(pos, head, member); \
|
||||
pos = spa_list_next(pos, member))
|
||||
|
||||
#define spa_list_for_each_prev(pos, head, curr, member) \
|
||||
for (pos = spa_list_last(curr, __typeof__(*pos), member); \
|
||||
!spa_list_is_end(pos, head, member); \
|
||||
pos = spa_list_prev(pos, member))
|
||||
|
||||
#define spa_list_for_each(pos, head, member) \
|
||||
spa_list_for_each_next(pos, head, head, member)
|
||||
|
||||
#define spa_list_for_each_reverse(pos, head, member) \
|
||||
spa_list_for_each_prev(pos, head, head, member)
|
||||
|
||||
#define spa_list_for_each_safe_next(pos, tmp, head, curr, member) \
|
||||
for (pos = spa_list_first(curr, __typeof__(*pos), member); \
|
||||
tmp = spa_list_next(pos, member), \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue