diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-03-04 11:38:40 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-14 16:33:59 +0000 |
commit | eec64066073428e38d5b0b6947ff302943188f65 (patch) | |
tree | ec55d656734941dee8b2a599b588a12cc174337d /meta/recipes-core/glib-2.0/glib-2.0/0003-tests-Fix-non-atomic-access-to-a-shared-variable.patch | |
parent | 8a74a7deca45ceef351f47a9f160df9bafc0f546 (diff) | |
download | poky-eec64066073428e38d5b0b6947ff302943188f65.tar.gz |
glib-2.0: Drop volatile qualifier
Fixes
glib/gatomic.h:112:5: error: argument 2 of '__atomic_load' discards 'volatile' qualifier [-Werror=incompatible-pointer-types]
(From OE-Core rev: 06ac55a06f2300fa5442ec73a28c3f52022cc640)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glib-2.0/glib-2.0/0003-tests-Fix-non-atomic-access-to-a-shared-variable.patch')
-rw-r--r-- | meta/recipes-core/glib-2.0/glib-2.0/0003-tests-Fix-non-atomic-access-to-a-shared-variable.patch | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0003-tests-Fix-non-atomic-access-to-a-shared-variable.patch b/meta/recipes-core/glib-2.0/glib-2.0/0003-tests-Fix-non-atomic-access-to-a-shared-variable.patch new file mode 100644 index 0000000000..8bc71a698d --- /dev/null +++ b/meta/recipes-core/glib-2.0/glib-2.0/0003-tests-Fix-non-atomic-access-to-a-shared-variable.patch | |||
@@ -0,0 +1,90 @@ | |||
1 | From ea746c79faf554d980c21b0e4381753e003d2dc6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Philip Withnall <pwithnall@endlessos.org> | ||
3 | Date: Wed, 11 Nov 2020 18:17:23 +0000 | ||
4 | Subject: [PATCH 03/29] tests: Fix non-atomic access to a shared variable | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | And drop the `volatile` qualifier from the variable, as that doesn’t | ||
10 | help with thread safety. | ||
11 | |||
12 | Signed-off-by: Philip Withnall <pwithnall@endlessos.org> | ||
13 | |||
14 | Helps: #600 | ||
15 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719] | ||
16 | --- | ||
17 | glib/tests/mainloop.c | 20 ++++++++++---------- | ||
18 | 1 file changed, 10 insertions(+), 10 deletions(-) | ||
19 | |||
20 | diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c | ||
21 | index 16763a0ea..563a951de 100644 | ||
22 | --- a/glib/tests/mainloop.c | ||
23 | +++ b/glib/tests/mainloop.c | ||
24 | @@ -918,7 +918,7 @@ test_mainloop_overflow (void) | ||
25 | g_main_context_unref (ctx); | ||
26 | } | ||
27 | |||
28 | -static volatile gint ready_time_dispatched; | ||
29 | +static gint ready_time_dispatched; /* (atomic) */ | ||
30 | |||
31 | static gboolean | ||
32 | ready_time_dispatch (GSource *source, | ||
33 | @@ -964,7 +964,7 @@ test_ready_time (void) | ||
34 | /* A source with no ready time set should not fire */ | ||
35 | g_assert_cmpint (g_source_get_ready_time (source), ==, -1); | ||
36 | while (g_main_context_iteration (NULL, FALSE)); | ||
37 | - g_assert_false (ready_time_dispatched); | ||
38 | + g_assert_false (g_atomic_int_get (&ready_time_dispatched)); | ||
39 | |||
40 | /* The ready time should not have been changed */ | ||
41 | g_assert_cmpint (g_source_get_ready_time (source), ==, -1); | ||
42 | @@ -978,37 +978,37 @@ test_ready_time (void) | ||
43 | */ | ||
44 | g_source_set_ready_time (source, g_get_monotonic_time () + G_TIME_SPAN_DAY); | ||
45 | while (g_main_context_iteration (NULL, FALSE)); | ||
46 | - g_assert_false (ready_time_dispatched); | ||
47 | + g_assert_false (g_atomic_int_get (&ready_time_dispatched)); | ||
48 | /* Make sure it didn't get reset */ | ||
49 | g_assert_cmpint (g_source_get_ready_time (source), !=, -1); | ||
50 | |||
51 | /* Ready time of -1 -> don't fire */ | ||
52 | g_source_set_ready_time (source, -1); | ||
53 | while (g_main_context_iteration (NULL, FALSE)); | ||
54 | - g_assert_false (ready_time_dispatched); | ||
55 | + g_assert_false (g_atomic_int_get (&ready_time_dispatched)); | ||
56 | /* Not reset, but should still be -1 from above */ | ||
57 | g_assert_cmpint (g_source_get_ready_time (source), ==, -1); | ||
58 | |||
59 | /* A ready time of the current time should fire immediately */ | ||
60 | g_source_set_ready_time (source, g_get_monotonic_time ()); | ||
61 | while (g_main_context_iteration (NULL, FALSE)); | ||
62 | - g_assert_true (ready_time_dispatched); | ||
63 | - ready_time_dispatched = FALSE; | ||
64 | + g_assert_true (g_atomic_int_get (&ready_time_dispatched)); | ||
65 | + g_atomic_int_set (&ready_time_dispatched, FALSE); | ||
66 | /* Should have gotten reset by the handler function */ | ||
67 | g_assert_cmpint (g_source_get_ready_time (source), ==, -1); | ||
68 | |||
69 | /* As well as one in the recent past... */ | ||
70 | g_source_set_ready_time (source, g_get_monotonic_time () - G_TIME_SPAN_SECOND); | ||
71 | while (g_main_context_iteration (NULL, FALSE)); | ||
72 | - g_assert_true (ready_time_dispatched); | ||
73 | - ready_time_dispatched = FALSE; | ||
74 | + g_assert_true (g_atomic_int_get (&ready_time_dispatched)); | ||
75 | + g_atomic_int_set (&ready_time_dispatched, FALSE); | ||
76 | g_assert_cmpint (g_source_get_ready_time (source), ==, -1); | ||
77 | |||
78 | /* Zero is the 'official' way to get a source to fire immediately */ | ||
79 | g_source_set_ready_time (source, 0); | ||
80 | while (g_main_context_iteration (NULL, FALSE)); | ||
81 | - g_assert_true (ready_time_dispatched); | ||
82 | - ready_time_dispatched = FALSE; | ||
83 | + g_assert_true (g_atomic_int_get (&ready_time_dispatched)); | ||
84 | + g_atomic_int_set (&ready_time_dispatched, FALSE); | ||
85 | g_assert_cmpint (g_source_get_ready_time (source), ==, -1); | ||
86 | |||
87 | /* Now do some tests of cross-thread wakeups. | ||
88 | -- | ||
89 | 2.30.1 | ||
90 | |||