1// 2// detail/impl/posix_mutex.ipp 3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4// 5// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6// 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) 9// 10 11#ifndef ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 12#define ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 13 14 15#include "asio/detail/config.hpp" 16 17#if defined(ASIO_HAS_PTHREADS) 18 19#include "asio/detail/posix_mutex.hpp" 20#include "asio/detail/throw_error.hpp" 21#include "asio/error.hpp" 22 23#include "asio/detail/push_options.hpp" 24 25namespace asio { 26namespace detail { 27 28posix_mutex::posix_mutex() 29{ 30 int error = ::pthread_mutex_init(&mutex_, 0); 31 asio::error_code ec(error, 32 asio::error::get_system_category()); 33 asio::detail::throw_error(ec, "mutex"); 34} 35 36} // namespace detail 37} // namespace asio 38 39#include "asio/detail/pop_options.hpp" 40 41#endif // defined(ASIO_HAS_PTHREADS) 42 43#endif // ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 44