diff options
author | Steve MacLean <Steve.MacLean@Microsoft.com> | 2020-05-21 18:04:59 -0400 |
---|---|---|
committer | Steve MacLean <Steve.MacLean@Microsoft.com> | 2020-05-21 18:04:59 -0400 |
commit | 45fc222a00f239a16f1420c4446113e8a730b75a (patch) | |
tree | 780d7a25a4a94411f4769a6b6ef9d6fb5c64f794 /src/arm | |
parent | da8dc856ab5646e04160060aae9425db3f5428ce (diff) | |
download | libunwind-45fc222a00f239a16f1420c4446113e8a730b75a.tar.gz |
Use C11 atomics
Diffstat (limited to 'src/arm')
-rw-r--r-- | src/arm/Gglobal.c | 6 | ||||
-rw-r--r-- | src/arm/Ginit_local.c | 2 | ||||
-rw-r--r-- | src/arm/Ginit_remote.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/arm/Gglobal.c b/src/arm/Gglobal.c index 7b93fbd8..2fb1d211 100644 --- a/src/arm/Gglobal.c +++ b/src/arm/Gglobal.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" HIDDEN define_lock (arm_lock); -HIDDEN int tdep_init_done; +HIDDEN atomic_bool tdep_init_done = 0; /* Unwinding methods to use. See UNW_METHOD_ enums */ HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL; @@ -40,7 +40,7 @@ tdep_init (void) lock_acquire (&arm_lock, saved_mask); { - if (tdep_init_done) + if (atomic_load(&tdep_init_done)) /* another thread else beat us to it... */ goto out; @@ -58,7 +58,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY arm_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 (&arm_lock, saved_mask); diff --git a/src/arm/Ginit_local.c b/src/arm/Ginit_local.c index e13519b7..8679805d 100644 --- a/src/arm/Ginit_local.c +++ b/src/arm/Ginit_local.c @@ -41,7 +41,7 @@ unw_init_local_common (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_pre { struct cursor *c = (struct cursor *) cursor; - if (!tdep_init_done) + if (!atomic_load(&tdep_init_done)) tdep_init (); Debug (1, "(cursor=%p)\n", c); diff --git a/src/arm/Ginit_remote.c b/src/arm/Ginit_remote.c index 9b8ba5b8..26d11ba9 100644 --- a/src/arm/Ginit_remote.c +++ b/src/arm/Ginit_remote.c @@ -33,7 +33,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); |