Index: webrtc/base/criticalsection.cc |
diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc |
index 851635d051d8f47717717bcfe680268e91540bbf..1f50c2355dbcef57b016f31dcc8c68501b9a84ca 100644 |
--- a/webrtc/base/criticalsection.cc |
+++ b/webrtc/base/criticalsection.cc |
@@ -88,7 +88,12 @@ void CriticalSection::Leave() UNLOCK_FUNCTION() { |
bool CriticalSection::CurrentThreadIsOwner() const { |
#if defined(WEBRTC_WIN) |
- return crit_.OwningThread == reinterpret_cast<HANDLE>(GetCurrentThreadId()); |
+ // OwningThread has type HANDLE but actually contains the Thread ID: |
+ // http://stackoverflow.com/questions/12675301/why-is-the-owningthread-member-of-critical-section-of-type-handle-when-it-is-de |
+ // Converting through size_t avoids the VS 2015 warning C4312: conversion from |
+ // 'type1' to 'type2' of greater size |
+ return crit_.OwningThread == |
+ reinterpret_cast<HANDLE>(static_cast<size_t>(GetCurrentThreadId())); |
#else |
#if CS_DEBUG_CHECKS |
return pthread_equal(thread_, pthread_self()); |