mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
shm: add shm_purge()
Destroys *all* buffers associated with the specified cookie.
This commit is contained in:
parent
4d3251a93b
commit
8e5d386afc
2 changed files with 19 additions and 0 deletions
17
shm.c
17
shm.c
|
|
@ -182,3 +182,20 @@ shm_fini(void)
|
|||
tll_remove(buffers, it);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
shm_purge(struct wl_shm *shm, unsigned long cookie)
|
||||
{
|
||||
LOG_DBG("cookie=%lx: purging all buffers", cookie);
|
||||
|
||||
/* Purge old buffers associated with this cookie */
|
||||
tll_foreach(buffers, it) {
|
||||
if (it->item.cookie != cookie)
|
||||
continue;
|
||||
|
||||
assert(!it->item.busy);
|
||||
|
||||
buffer_destroy(&it->item);
|
||||
tll_remove(buffers, it);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
shm.h
2
shm.h
|
|
@ -24,3 +24,5 @@ struct buffer {
|
|||
struct buffer *shm_get_buffer(
|
||||
struct wl_shm *shm, int width, int height, unsigned long cookie);
|
||||
void shm_fini(void);
|
||||
|
||||
void shm_purge(struct wl_shm *shm, unsigned long cookie);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue