mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-25 01:40:19 -05:00
shm: add shm_get_many() - allows buffers to share a single pool
shm_get_many() always returns new buffers (i.e. never old, cached ones). The newly allocated buffers are also marked for immediate purging, meaning they’ll be destroyed on the next call to either shm_get_buffer(), or shm_get_many(). Furthermore, we add a new attribute, ‘locked’, to the buffer struct. When auto purging buffers, look at this instead of comparing cookies. Buffer consumers are expected to set ‘locked’ while they hold a reference to it, and don’t want it destroyed behind their back.
This commit is contained in:
parent
5e64c67c25
commit
7533684d8f
3 changed files with 274 additions and 129 deletions
4
render.c
4
render.c
|
|
@ -2322,6 +2322,7 @@ grid_render(struct terminal *term)
|
|||
}
|
||||
|
||||
if (term->render.last_buf != NULL) {
|
||||
term->render.last_buf->locked = false;
|
||||
free(term->render.last_buf->scroll_damage);
|
||||
term->render.last_buf->scroll_damage = NULL;
|
||||
}
|
||||
|
|
@ -2330,6 +2331,7 @@ grid_render(struct terminal *term)
|
|||
term->render.was_flashing = term->flash.active;
|
||||
term->render.was_searching = term->is_searching;
|
||||
|
||||
buf->locked = true;
|
||||
buf->age = 0;
|
||||
|
||||
xassert(buf->scroll_damage == NULL);
|
||||
|
|
@ -3416,6 +3418,8 @@ damage_view:
|
|||
tll_free(term->normal.scroll_damage);
|
||||
tll_free(term->alt.scroll_damage);
|
||||
|
||||
if (term->render.last_buf != NULL)
|
||||
term->render.last_buf->locked = false;
|
||||
term->render.last_buf = NULL;
|
||||
term_damage_view(term);
|
||||
render_refresh_csd(term);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue