From 4d9bda0d08c972b36cabb0ec59b33a9591fc2382 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Fri, 13 Jan 2017 13:50:21 -0600 Subject: [PATCH] Bug 1317642 Disable WeakPtr thread assertions on MinGW r=froydnj MinGW has two threading models: win32 API based, which disables std::thread, and POSIX based which enables it but requires an emulation library (winpthreads). Rather than attempting to switch to pthread emulation at this point, we are disabling the std::thread based assertion checking for WeakPtr on MinGW. MozReview-Commit-ID: BmHo70n6AuK --HG-- extra : rebase_source : 08495775b2925a797c8098216911d30c0b79ef3d --- mfbt/WeakPtr.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mfbt/WeakPtr.h b/mfbt/WeakPtr.h index 61de977c3cf8..ef0c19f4ef0c 100644 --- a/mfbt/WeakPtr.h +++ b/mfbt/WeakPtr.h @@ -88,8 +88,19 @@ // its dereference, and destruction of the real object must all happen // on a single thread. The following macros implement assertions for // checking these conditions. +// +// We disable this on MinGW. MinGW has two threading models: win32 +// API based, which disables std::thread; and POSIX based which +// enables it but requires an emulation library (winpthreads). +// Rather than attempting to switch to pthread emulation at this point, +// we are disabling the std::thread based assertion checking. +// +// In the future, to enable it we could +// a. have libgcc/stdc++ support win32 threads natively +// b. switch to POSIX-based threading in MinGW with pthread emulation +// c. refactor it to not use std::thread -#if defined(DEBUG) || (defined(NIGHTLY_BUILD) && !defined(MOZ_PROFILING)) +#if !defined(__MINGW32__) && (defined(DEBUG) || (defined(NIGHTLY_BUILD) && !defined(MOZ_PROFILING))) #include #define MOZ_WEAKPTR_DECLARE_THREAD_SAFETY_CHECK \