summaryrefslogtreecommitdiff
path: root/src/s390x
diff options
context:
space:
mode:
authorSteve MacLean <Steve.MacLean@Microsoft.com>2020-05-21 18:04:59 -0400
committerSteve MacLean <Steve.MacLean@Microsoft.com>2020-05-21 18:04:59 -0400
commit45fc222a00f239a16f1420c4446113e8a730b75a (patch)
tree780d7a25a4a94411f4769a6b6ef9d6fb5c64f794 /src/s390x
parentda8dc856ab5646e04160060aae9425db3f5428ce (diff)
downloadlibunwind-45fc222a00f239a16f1420c4446113e8a730b75a.tar.gz
Use C11 atomics
Diffstat (limited to 'src/s390x')
-rw-r--r--src/s390x/Gglobal.c6
-rw-r--r--src/s390x/Ginit_local.c2
-rw-r--r--src/s390x/Ginit_remote.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/s390x/Gglobal.c b/src/s390x/Gglobal.c
index e2abe89d..be49c3f6 100644
--- a/src/s390x/Gglobal.c
+++ b/src/s390x/Gglobal.c
@@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (s390x_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
/* The API register numbers are exactly the same as the .eh_frame
registers, for now at least. */
@@ -81,7 +81,7 @@ tdep_init (void)
lock_acquire (&s390x_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -94,7 +94,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
s390x_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&s390x_lock, saved_mask);
diff --git a/src/s390x/Ginit_local.c b/src/s390x/Ginit_local.c
index 5eaead0f..06a7c497 100644
--- a/src/s390x/Ginit_local.c
+++ b/src/s390x/Ginit_local.c
@@ -43,7 +43,7 @@ unw_init_local_common (unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_i
{
struct cursor *c = (struct cursor *) cursor;
- if (unlikely (!tdep_init_done))
+ if (unlikely (!atomic_load(&tdep_init_done)))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/s390x/Ginit_remote.c b/src/s390x/Ginit_remote.c
index efd61d64..9ab1d6df 100644
--- a/src/s390x/Ginit_remote.c
+++ b/src/s390x/Ginit_remote.c
@@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);