diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2021-12-05 19:51:39 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2021-12-21 09:34:29 +0300 |
commit | d6b8b4e531204e42e545e8fba610579154add888 (patch) | |
tree | 0191a981251cb1e0bd5b96832bff94064ade951a | |
parent | 5b9bbc225c044b6af76e0a2859158dae02375394 (diff) | |
download | bdwgc-d6b8b4e531204e42e545e8fba610579154add888.tar.gz |
Fix lock assertion violation in GC_find_limit if always multi-threaded
Issue #399 (bdwgc).
* misc.c [GC_ASSERTIONS && GC_ALWAYS_MULTITHREADED
&& (SEARCH_FOR_DATA_START || NETBSD)] (GC_init): Wrap
GC_init_linux_data_start() and GC_init_netbsd_elf() calls into
LOCK/UNLOCK.
-rw-r--r-- | misc.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1186,12 +1186,20 @@ GC_API void GC_CALL GC_init(void) /* entirety as part of the root set. This will grow them to */ /* maximum size, and is generally not desirable. */ # endif +# if defined(GC_ASSERTIONS) && defined(GC_ALWAYS_MULTITHREADED) \ + && (defined(SEARCH_FOR_DATA_START) || defined(NETBSD)) + LOCK(); /* just to set GC_lock_holder */ +# endif # if defined(SEARCH_FOR_DATA_START) GC_init_linux_data_start(); # endif # if defined(NETBSD) && defined(__ELF__) GC_init_netbsd_elf(); # endif +# if defined(GC_ASSERTIONS) && defined(GC_ALWAYS_MULTITHREADED) \ + && (defined(SEARCH_FOR_DATA_START) || defined(NETBSD)) + UNLOCK(); +# endif # if !defined(THREADS) || defined(GC_PTHREADS) \ || defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) \ || defined(GC_WIN32_THREADS) || defined(GC_SOLARIS_THREADS) |