mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 13:17:23 +02:00
Mingw doesn't have _RTL_CRITICAL_SECTION
This commit is contained in:
@@ -61,7 +61,9 @@ extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRIT
|
|||||||
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *);
|
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *);
|
||||||
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *);
|
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *);
|
||||||
|
|
||||||
#else
|
typedef ::_RTL_CRITICAL_SECTION rtl_critical_section;
|
||||||
|
|
||||||
|
#else // #ifndef BOOST_USE_WINDOWS_H
|
||||||
|
|
||||||
typedef ::CRITICAL_SECTION critical_section;
|
typedef ::CRITICAL_SECTION critical_section;
|
||||||
|
|
||||||
@@ -74,6 +76,8 @@ using ::EnterCriticalSection;
|
|||||||
using ::LeaveCriticalSection;
|
using ::LeaveCriticalSection;
|
||||||
using ::DeleteCriticalSection;
|
using ::DeleteCriticalSection;
|
||||||
|
|
||||||
|
typedef ::CRITICAL_SECTION rtl_critical_section;
|
||||||
|
|
||||||
#endif // #ifndef BOOST_USE_WINDOWS_H
|
#endif // #ifndef BOOST_USE_WINDOWS_H
|
||||||
|
|
||||||
class lightweight_mutex
|
class lightweight_mutex
|
||||||
@@ -90,15 +94,15 @@ public:
|
|||||||
lightweight_mutex()
|
lightweight_mutex()
|
||||||
{
|
{
|
||||||
#if BOOST_PLAT_WINDOWS_RUNTIME
|
#if BOOST_PLAT_WINDOWS_RUNTIME
|
||||||
boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0);
|
boost::detail::InitializeCriticalSectionEx(reinterpret_cast< rtl_critical_section* >(&cs_), 4000, 0);
|
||||||
#else
|
#else
|
||||||
boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_));
|
boost::detail::InitializeCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~lightweight_mutex()
|
~lightweight_mutex()
|
||||||
{
|
{
|
||||||
boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_));
|
boost::detail::DeleteCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
|
||||||
}
|
}
|
||||||
|
|
||||||
class scoped_lock;
|
class scoped_lock;
|
||||||
@@ -117,12 +121,12 @@ public:
|
|||||||
|
|
||||||
explicit scoped_lock(lightweight_mutex & m): m_(m)
|
explicit scoped_lock(lightweight_mutex & m): m_(m)
|
||||||
{
|
{
|
||||||
boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_));
|
boost::detail::EnterCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_));
|
||||||
}
|
}
|
||||||
|
|
||||||
~scoped_lock()
|
~scoped_lock()
|
||||||
{
|
{
|
||||||
boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_));
|
boost::detail::LeaveCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user