1 #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED
\r
2 #define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED
\r
4 // MS compatible compilers support #pragma once
\r
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
\r
11 // boost/detail/lwm_pthreads.hpp
\r
13 // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
\r
15 // Distributed under the Boost Software License, Version 1.0. (See
\r
16 // accompanying file LICENSE_1_0.txt or copy at
\r
17 // http://www.boost.org/LICENSE_1_0.txt)
\r
20 #include <boost/assert.hpp>
\r
21 #include <pthread.h>
\r
29 class lightweight_mutex
\r
35 lightweight_mutex(lightweight_mutex const &);
\r
36 lightweight_mutex & operator=(lightweight_mutex const &);
\r
43 // HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
\r
45 #if defined(__hpux) && defined(_DECTHREADS_)
\r
46 BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 );
\r
48 BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 );
\r
52 ~lightweight_mutex()
\r
54 BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 );
\r
58 friend class scoped_lock;
\r
64 pthread_mutex_t & m_;
\r
66 scoped_lock(scoped_lock const &);
\r
67 scoped_lock & operator=(scoped_lock const &);
\r
71 scoped_lock(lightweight_mutex & m): m_(m.m_)
\r
73 BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
\r
78 BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
\r
83 } // namespace detail
\r
85 } // namespace boost
\r
87 #endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED
\r