1 #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
2 #define BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
9 // boost/detail/lwm_win32_cs.hpp
11 // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
13 // Permission to copy, use, modify, sell and distribute this software
14 // is granted provided this copyright notice appears in all copies.
15 // This software is provided "as is" without express or implied
16 // warranty, and with no claim as to its suitability for any purpose.
19 #include <boost/detail/winapi.hpp>
27 class lightweight_mutex
31 winapi::critical_section cs_;
33 lightweight_mutex(lightweight_mutex const &);
34 lightweight_mutex & operator=(lightweight_mutex const &);
40 winapi::InitializeCriticalSection(&cs_);
45 winapi::DeleteCriticalSection(&cs_);
49 friend class scoped_lock;
55 lightweight_mutex & m_;
57 scoped_lock(scoped_lock const &);
58 scoped_lock & operator=(scoped_lock const &);
62 explicit scoped_lock(lightweight_mutex & m): m_(m)
64 winapi::EnterCriticalSection(&m_.cs_);
69 winapi::LeaveCriticalSection(&m_.cs_);
78 #endif // #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED