10ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// 20ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// detail/impl/posix_mutex.ipp 30ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 40ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// 50ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) 60ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// 70ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// Distributed under the Boost Software License, Version 1.0. (See accompanying 80ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 90ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// 100ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 110ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#ifndef ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 120ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#define ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 130ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 140ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 150ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/config.hpp" 160ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 170ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#if defined(ASIO_HAS_PTHREADS) 180ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 190ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/posix_mutex.hpp" 200ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/throw_error.hpp" 210ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/error.hpp" 220ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 230ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/push_options.hpp" 240ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 250ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace asio { 260ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace detail { 270ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 280ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieposix_mutex::posix_mutex() 290ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{ 300ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie int error = ::pthread_mutex_init(&mutex_, 0); 310ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie asio::error_code ec(error, 320ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie asio::error::get_system_category()); 330ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie asio::detail::throw_error(ec, "mutex"); 340ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} 350ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 360ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace detail 370ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace asio 380ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 390ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/pop_options.hpp" 400ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 410ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#endif // defined(ASIO_HAS_PTHREADS) 420ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie 430ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#endif // ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 44