Skip to content

Commit

Permalink
Applying patch for MINGW thread issue prescribed at google/googletest…
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Russell committed Mar 28, 2018
1 parent bb0f36e commit 5200d60
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
40 changes: 40 additions & 0 deletions 166.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 0094ed5..411f132 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -604,7 +604,7 @@ struct _RTL_CRITICAL_SECTION;
|| GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL)
#endif // GTEST_HAS_PTHREAD

-#if GTEST_HAS_PTHREAD
+#if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
// true.
# include <pthread.h> // NOLINT
@@ -1441,7 +1441,7 @@ void SetInjectableArgvs(const ::std::vector<testing::internal::string>*

// Defines synchronization primitives.
#if GTEST_IS_THREADSAFE
-# if GTEST_HAS_PTHREAD
+# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
// Sleeps for (roughly) n milliseconds. This function is only for testing
// Google Test's own constructs. Don't use it in user tests, either
// directly or indirectly.
@@ -1458,7 +1458,7 @@ inline void SleepMilliseconds(int n) {
// Notification has already been imported into the namespace.
// Nothing to do here.

-# elif GTEST_HAS_PTHREAD
+# elif GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
// Allows a controller thread to pause execution of newly created
// threads until notified. Instances of this class must be created
// and destroyed in the controller thread.
@@ -1918,7 +1918,7 @@ class ThreadLocal : public ThreadLocalBase {
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
};

-# elif GTEST_HAS_PTHREAD
+# elif GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW

// MutexBase and Mutex implement mutex on pthreads-based platforms.
class MutexBase {
3 changes: 2 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GTestConan(ConanFile):
url = "http://github.com/bincrafters/conan-gtest"
license = "BSD 3-Clause"
exports = ["LICENSE.md"]
exports_sources = ["CMakeLists.txt", "1339.patch", "FindGTest.cmake", "FindGMock.cmake"]
exports_sources = ["CMakeLists.txt", "1339.patch", "166.patch", "FindGTest.cmake", "FindGMock.cmake"]
source_subfolder = "source_subfolder"
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
Expand All @@ -31,6 +31,7 @@ def source(self):
os.rename(extracted_dir, self.source_subfolder)

tools.patch(base_path=self.source_subfolder, patch_file='1339.patch')
tools.patch(base_path=self.source_subfolder, patch_file='166.patch')

def build(self):

Expand Down

0 comments on commit 5200d60

Please sign in to comment.