1// 2// detail/impl/posix_tss_ptr.ipp 3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4// 5// Copyright (c) 2003-2016 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_TSS_PTR_IPP 12#define ASIO_DETAIL_IMPL_POSIX_TSS_PTR_IPP 13 14#if defined(_MSC_VER) && (_MSC_VER >= 1200) 15# pragma once 16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 18#include "asio/detail/config.hpp" 19 20#if defined(ASIO_HAS_PTHREADS) 21 22#include "asio/detail/posix_tss_ptr.hpp" 23#include "asio/detail/throw_error.hpp" 24#include "asio/error.hpp" 25 26#include "asio/detail/push_options.hpp" 27 28namespace asio { 29namespace detail { 30 31void posix_tss_ptr_create(pthread_key_t& key) 32{ 33 int error = ::pthread_key_create(&key, 0); 34 asio::error_code ec(error, 35 asio::error::get_system_category()); 36 asio::detail::throw_error(ec, "tss"); 37} 38 39} // namespace detail 40} // namespace asio 41 42#include "asio/detail/pop_options.hpp" 43 44#endif // defined(ASIO_HAS_PTHREADS) 45 46#endif // ASIO_DETAIL_IMPL_POSIX_TSS_PTR_IPP 47