summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp46
1 files changed, 9 insertions, 37 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp
index 107d707..176a5fd 100644
--- a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp
+++ b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp
@@ -66,15 +66,7 @@ public:
// Lock the mutex.
void lock()
{
- int error = do_lock();
- if (error != 0)
- {
- boost::system::system_error e(
- boost::system::error_code(error,
- boost::asio::error::get_system_category()),
- "mutex");
- boost::throw_exception(e);
- }
+ ::EnterCriticalSection(&crit_section_);
}
// Unlock the mutex.
@@ -92,12 +84,20 @@ private:
#if defined(__MINGW32__)
// Not sure if MinGW supports structured exception handling, so for now
// we'll just call the Windows API and hope.
+# if defined(UNDER_CE)
::InitializeCriticalSection(&crit_section_);
+# else
+ ::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000);
+# endif
return 0;
#else
__try
{
+# if defined(UNDER_CE)
::InitializeCriticalSection(&crit_section_);
+# else
+ ::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000);
+# endif
}
__except(GetExceptionCode() == STATUS_NO_MEMORY
? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
@@ -109,34 +109,6 @@ private:
#endif
}
- // Locking must be performed in a separate function to lock() since the
- // compiler does not support the use of structured exceptions and C++
- // exceptions in the same function.
- int do_lock()
- {
-#if defined(__MINGW32__)
- // Not sure if MinGW supports structured exception handling, so for now
- // we'll just call the Windows API and hope.
- ::EnterCriticalSection(&crit_section_);
- return 0;
-#else
- __try
- {
- ::EnterCriticalSection(&crit_section_);
- }
- __except(GetExceptionCode() == STATUS_INVALID_HANDLE
- || GetExceptionCode() == STATUS_NO_MEMORY
- ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
- {
- if (GetExceptionCode() == STATUS_NO_MEMORY)
- return ERROR_OUTOFMEMORY;
- return ERROR_INVALID_HANDLE;
- }
-
- return 0;
-#endif
- }
-
::CRITICAL_SECTION crit_section_;
};