File tree Expand file tree Collapse file tree
asio/include/asio/detail/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ int win_mutex::do_init()
5252# endif
5353 return 0 ;
5454#else
55- __try
55+ try
5656 {
5757# if defined(UNDER_CE)
5858 ::InitializeCriticalSection (&crit_section_);
@@ -64,10 +64,11 @@ int win_mutex::do_init()
6464 return ::GetLastError ();
6565# endif
6666 }
67- __except (GetExceptionCode () == STATUS_NO_MEMORY
68- ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
67+ catch (const std::bad_alloc&)
6968 {
70- return ERROR_OUTOFMEMORY;
69+ if (GetExceptionCode () == STATUS_NO_MEMORY
70+ ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
71+ return ERROR_OUTOFMEMORY;
7172 }
7273
7374 return 0 ;
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ int win_static_mutex::do_init()
8989 }
9090# endif
9191#else
92- __try
92+ try
9393 {
9494# if defined(UNDER_CE)
9595 ::InitializeCriticalSection (&crit_section_);
@@ -111,12 +111,15 @@ int win_static_mutex::do_init()
111111 }
112112# endif
113113 }
114- __except (GetExceptionCode () == STATUS_NO_MEMORY
115- ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
114+ catch (const std::bad_alloc&)
116115 {
117- ::ReleaseMutex (mutex);
118- ::CloseHandle (mutex);
119- return ERROR_OUTOFMEMORY;
116+ if (GetExceptionCode () == STATUS_NO_MEMORY
117+ ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
118+ {
119+ ::ReleaseMutex (mutex);
120+ ::CloseHandle (mutex);
121+ return ERROR_OUTOFMEMORY;
122+ }
120123 }
121124#endif
122125
You can’t perform that action at this time.
0 commit comments