2 // detail/impl/posix_mutex.ipp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP
12 #define ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include "asio/detail/config.hpp"
20 #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS)
22 #include "asio/detail/posix_mutex.hpp"
23 #include "asio/detail/throw_error.hpp"
24 #include "asio/error.hpp"
26 #include "asio/detail/push_options.hpp"
31 posix_mutex::posix_mutex()
33 int error = ::pthread_mutex_init(&mutex_, 0);
34 asio::error_code ec(error,
35 asio::error::get_system_category());
36 asio::detail::throw_error(ec, "mutex");
42 #include "asio/detail/pop_options.hpp"
44 #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS)
46 #endif // ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP