1// 2// detail/impl/posix_tss_ptr.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_TSS_PTR_IPP 12#define ASIO_DETAIL_IMPL_POSIX_TSS_PTR_IPP 13 14 15#include "asio/detail/config.hpp" 16 17#if defined(ASIO_HAS_PTHREADS) 18 19#include "asio/detail/posix_tss_ptr.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 28void posix_tss_ptr_create(pthread_key_t& key) 29{ 30 int error = ::pthread_key_create(&key, 0); 31 asio::error_code ec(error, 32 asio::error::get_system_category()); 33 asio::detail::throw_error(ec, "tss"); 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_TSS_PTR_IPP 44