Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 95c7fc6

Browse filesBrowse files
nodejs-github-botaduh95
authored andcommitted
deps: update googletest to 2461743991f9aa53e9a3625eafcbacd81a3c74cd
PR-URL: #62484 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 3796a73 commit 95c7fc6
Copy full SHA for 95c7fc6

2 files changed

+50-3Lines changed: 50 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/googletest/include/gtest/internal/gtest-port.h‎

Copy file name to clipboardExpand all lines: deps/googletest/include/gtest/internal/gtest-port.h
+34-3Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,16 +1236,46 @@ class GTEST_API_ [[nodiscard]] AutoHandle {
12361236
// Nothing to do here.
12371237

12381238
#else
1239-
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
1240-
/* class A needs to have dll-interface to be used by clients of class B */)
1241-
12421239
// Allows a controller thread to pause execution of newly created
12431240
// threads until notified. Instances of this class must be created
12441241
// and destroyed in the controller thread.
12451242
//
12461243
// This class is only for testing Google Test's own constructs. Do not
12471244
// use it in user tests, either directly or indirectly.
12481245
// TODO(b/203539622): Replace unconditionally with absl::Notification.
1246+
#ifdef GTEST_OS_WINDOWS_MINGW
1247+
// GCC version < 13 with the win32 thread model does not provide std::mutex and
1248+
// std::condition_variable in the <mutex> and <condition_variable> headers. So
1249+
// we implement the Notification class using a Windows manual-reset event. See
1250+
// https://gcc.gnu.org/gcc-13/changes.html#windows.
1251+
class GTEST_API_ [[nodiscard]] Notification {
1252+
public:
1253+
Notification();
1254+
Notification(const Notification&) = delete;
1255+
Notification& operator=(const Notification&) = delete;
1256+
~Notification();
1257+
1258+
// Notifies all threads created with this notification to start. Must
1259+
// be called from the controller thread.
1260+
void Notify();
1261+
1262+
// Blocks until the controller thread notifies. Must be called from a test
1263+
// thread.
1264+
void WaitForNotification();
1265+
1266+
private:
1267+
// Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
1268+
// avoid including <windows.h> in this header file. Including <windows.h> is
1269+
// undesirable because it defines a lot of symbols and macros that tend to
1270+
// conflict with client code. This assumption is verified by
1271+
// WindowsTypesTest.HANDLEIsVoidStar.
1272+
typedef void* Handle;
1273+
Handle event_;
1274+
};
1275+
#else
1276+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
1277+
/* class A needs to have dll-interface to be used by clients of class B */)
1278+
12491279
class GTEST_API_ [[nodiscard]] Notification {
12501280
public:
12511281
Notification() : notified_(false) {}
@@ -1273,6 +1303,7 @@ class GTEST_API_ [[nodiscard]] Notification {
12731303
bool notified_;
12741304
};
12751305
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
1306+
#endif // GTEST_OS_WINDOWS_MINGW
12761307
#endif // GTEST_HAS_NOTIFICATION_
12771308

12781309
// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
Collapse file

‎deps/googletest/src/gtest-port.cc‎

Copy file name to clipboardExpand all lines: deps/googletest/src/gtest-port.cc
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,22 @@ bool AutoHandle::IsCloseable() const {
303303
return handle_ != nullptr && handle_ != INVALID_HANDLE_VALUE;
304304
}
305305

306+
#if !GTEST_HAS_NOTIFICATION_ && defined(GTEST_OS_WINDOWS_MINGW)
307+
Notification::Notification() {
308+
// Create a manual-reset event object.
309+
event_ = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
310+
GTEST_CHECK_(event_ != nullptr);
311+
}
312+
313+
Notification::~Notification() { ::CloseHandle(event_); }
314+
315+
void Notification::Notify() { GTEST_CHECK_(::SetEvent(event_)); }
316+
317+
void Notification::WaitForNotification() {
318+
GTEST_CHECK_(::WaitForSingleObject(event_, INFINITE) == WAIT_OBJECT_0);
319+
}
320+
#endif // !GTEST_HAS_NOTIFICATION_ && defined(GTEST_OS_WINDOWS_MINGW)
321+
306322
Mutex::Mutex()
307323
: owner_thread_id_(0),
308324
type_(kDynamic),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.