mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
display-test: Fix a race condition in test suite
Several tests in this suite use setting and checking client.display_stopped (in test-compositor.h) to synchronise between threads. This is a data race because display_stopped is a non-atomic int. Fix this by making it an atomic_bool instead. We don't need to change the access code because reads and writes are sequentially consistent by default. This can be reproduced (with both clang and gcc) by running ``` meson -Db_sanitize=thread build cd build ninja meson test ``` Signed-off-by: Fergus Dall <sidereal@google.com>
This commit is contained in:
parent
5eb5620cbd
commit
e949b3bfbb
1 changed files with 2 additions and 1 deletions
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include "wayland-server.h"
|
||||
#include "wayland-client.h"
|
||||
|
|
@ -65,7 +66,7 @@ struct client {
|
|||
struct wl_display *wl_display;
|
||||
struct test_compositor *tc;
|
||||
|
||||
int display_stopped;
|
||||
atomic_bool display_stopped;
|
||||
};
|
||||
|
||||
struct client *client_connect(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue