@@ -128,12 +128,25 @@ define DEF_THIRD_PARTY_TARGETS
128
128
129
129
# $(1) is the target triple
130
130
131
- ifeq ($$(CFG_WINDOWSY_$(1 ) ) , 1)
132
- # This isn't necessarily a desired option, but it's harmless and works around
133
- # what appears to be a mingw-w64 bug.
131
+ ifeq ($$(CFG_WINDOWSY_$(1 ) ) ,1)
132
+ # A bit of history here, this used to be --enable-lazy-lock added in #14006
133
+ # which was filed with jemalloc in jemalloc/jemalloc#83 which was also
134
+ # reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/
135
+ #
136
+ # When updating jemalloc to 4.0, however, it was found that binaries would
137
+ # exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread
138
+ # was unlocking a mutex it never locked. Disabling this "lazy lock" option
139
+ # seems to fix the issue, but it was enabled by default for MinGW targets in
140
+ # 13473c7 for jemalloc.
141
+ #
142
+ # As a result of all that, force disabling lazy lock on Windows, and after
143
+ # reading some code it at least *appears* that the initialization of mutexes
144
+ # is otherwise ok in jemalloc, so shouldn't cause problems hopefully...
134
145
#
135
- # https://sourceforge.net/p/mingw-w64/bugs/395/
136
- JEMALLOC_ARGS_$(1) := --enable-lazy-lock
146
+ # tl;dr: make windows behave like other platforms by disabling lazy locking,
147
+ # but requires passing an option due to a historical default with
148
+ # jemalloc.
149
+ JEMALLOC_ARGS_$(1) := --disable-lazy-lock
137
150
else ifeq ($(OSTYPE_$(1)), apple-ios)
138
151
JEMALLOC_ARGS_$(1) := --disable-tls
139
152
else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
0 commit comments