mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-24 01:40:35 -05:00
util: unified and enhanced zombie handing in wl_map
servers and clients now both use zombies. Zombies are interface pointers, so that they retain info for demarshalling fds AND new_id args, which must be turned into other zombies. Demarshalling messages to zombies is handled by the same wl_connection_demarshal code used for messages to live objects. Server zombies are eventually reaped after moving through FIFO zombie ring, because there is no delete_id request in the protocol. Signed-off-by: Jonathan Leivent <jleivent@comcast.net>
This commit is contained in:
parent
0db836ebc8
commit
dcd5996175
7 changed files with 436 additions and 180 deletions
|
|
@ -89,7 +89,8 @@ TEST(map_remove)
|
|||
assert(wl_map_lookup(&map, j) == &b);
|
||||
assert(wl_map_lookup(&map, k) == &c);
|
||||
|
||||
wl_map_remove(&map, j);
|
||||
wl_map_mark_deleted(&map, j);
|
||||
wl_map_zombify(&map, j, NULL);
|
||||
assert(wl_map_lookup(&map, j) == NULL);
|
||||
|
||||
/* Verify that we insert d at the hole left by removing b */
|
||||
|
|
@ -107,15 +108,18 @@ TEST(map_flags)
|
|||
|
||||
wl_map_init(&map, WL_MAP_SERVER_SIDE);
|
||||
i = wl_map_insert_new(&map, 0, &a);
|
||||
j = wl_map_insert_new(&map, 1, &b);
|
||||
uint32_t flag_value = 0xabcdef10;
|
||||
/* 3 bits of flags are used internally, so we lose the high 3 here: */
|
||||
uint32_t high_truncated_flag_value = (flag_value << 3) >> 3;
|
||||
j = wl_map_insert_new(&map, high_truncated_flag_value, &b);
|
||||
assert(i == WL_SERVER_ID_START);
|
||||
assert(j == WL_SERVER_ID_START + 1);
|
||||
|
||||
assert(wl_map_lookup(&map, i) == &a);
|
||||
assert(wl_map_lookup(&map, j) == &b);
|
||||
|
||||
assert(wl_map_lookup_flags(&map, i) == 0);
|
||||
assert(wl_map_lookup_flags(&map, j) == 1);
|
||||
assert(wl_map_lookup_flags(&map, i) == 0);
|
||||
assert(wl_map_lookup_flags(&map, j) == high_truncated_flag_value);
|
||||
|
||||
wl_map_release(&map);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue