Renamed the pthread_* wrappers to posix_*.
This commit is contained in:
parent
9154937018
commit
bdead8566a
@ -16,11 +16,11 @@ nobase_include_HEADERS = \
|
||||
asio/detail/mutex.hpp \
|
||||
asio/detail/pipe_select_interrupter.hpp \
|
||||
asio/detail/pop_options.hpp \
|
||||
asio/detail/posix_event.hpp \
|
||||
asio/detail/posix_mutex.hpp \
|
||||
asio/detail/posix_thread.hpp \
|
||||
asio/detail/posix_time.hpp \
|
||||
asio/detail/pthread_event.hpp \
|
||||
asio/detail/pthread_mutex.hpp \
|
||||
asio/detail/pthread_thread.hpp \
|
||||
asio/detail/pthread_tss_bool.hpp \
|
||||
asio/detail/posix_tss_bool.hpp \
|
||||
asio/detail/push_options.hpp \
|
||||
asio/detail/reactive_dgram_socket_service.hpp \
|
||||
asio/detail/reactive_socket_acceptor_service.hpp \
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#include "asio/detail/pthread_event.hpp"
|
||||
#include "asio/detail/posix_event.hpp"
|
||||
#include "asio/detail/win_event.hpp"
|
||||
|
||||
namespace asio {
|
||||
@ -26,7 +26,7 @@ namespace detail {
|
||||
#if defined(_WIN32)
|
||||
typedef win_event event;
|
||||
#else
|
||||
typedef pthread_event event;
|
||||
typedef posix_event event;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#include "asio/detail/pthread_mutex.hpp"
|
||||
#include "asio/detail/posix_mutex.hpp"
|
||||
#include "asio/detail/win_mutex.hpp"
|
||||
|
||||
namespace asio {
|
||||
@ -26,7 +26,7 @@ namespace detail {
|
||||
#if defined(_WIN32)
|
||||
typedef win_mutex mutex;
|
||||
#else
|
||||
typedef pthread_mutex mutex;
|
||||
typedef posix_mutex mutex;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// pthread_event.hpp
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
// posix_event.hpp
|
||||
// ~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003 Christopher M. Kohlhoff (chris@kohlhoff.com)
|
||||
//
|
||||
@ -12,8 +12,8 @@
|
||||
// no claim as to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#ifndef ASIO_DETAIL_PTHREAD_EVENT_HPP
|
||||
#define ASIO_DETAIL_PTHREAD_EVENT_HPP
|
||||
#ifndef ASIO_DETAIL_POSIX_EVENT_HPP
|
||||
#define ASIO_DETAIL_POSIX_EVENT_HPP
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
@ -27,12 +27,12 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
class pthread_event
|
||||
class posix_event
|
||||
: private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
// Constructor.
|
||||
pthread_event()
|
||||
posix_event()
|
||||
: signalled_(false)
|
||||
{
|
||||
::pthread_mutex_init(&mutex_, 0);
|
||||
@ -40,7 +40,7 @@ public:
|
||||
}
|
||||
|
||||
// Destructor.
|
||||
~pthread_event()
|
||||
~posix_event()
|
||||
{
|
||||
::pthread_cond_destroy(&cond_);
|
||||
::pthread_mutex_destroy(&mutex_);
|
||||
@ -85,4 +85,4 @@ private:
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_DETAIL_PTHREAD_EVENT_HPP
|
||||
#endif // ASIO_DETAIL_POSIX_EVENT_HPP
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// pthread_mutex.hpp
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
// posix_mutex.hpp
|
||||
// ~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003 Christopher M. Kohlhoff (chris@kohlhoff.com)
|
||||
//
|
||||
@ -12,8 +12,8 @@
|
||||
// no claim as to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#ifndef ASIO_DETAIL_PTHREAD_MUTEX_HPP
|
||||
#define ASIO_DETAIL_PTHREAD_MUTEX_HPP
|
||||
#ifndef ASIO_DETAIL_POSIX_MUTEX_HPP
|
||||
#define ASIO_DETAIL_POSIX_MUTEX_HPP
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
@ -29,20 +29,20 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
class pthread_mutex
|
||||
class posix_mutex
|
||||
: private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef asio::detail::scoped_lock<pthread_mutex> scoped_lock;
|
||||
typedef asio::detail::scoped_lock<posix_mutex> scoped_lock;
|
||||
|
||||
// Constructor.
|
||||
pthread_mutex()
|
||||
posix_mutex()
|
||||
{
|
||||
::pthread_mutex_init(&mutex_, 0);
|
||||
}
|
||||
|
||||
// Destructor.
|
||||
~pthread_mutex()
|
||||
~posix_mutex()
|
||||
{
|
||||
::pthread_mutex_destroy(&mutex_);
|
||||
}
|
||||
@ -70,4 +70,4 @@ private:
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_DETAIL_PTHREAD_MUTEX_HPP
|
||||
#endif // ASIO_DETAIL_POSIX_MUTEX_HPP
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// pthread_thread.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
// posix_thread.hpp
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003 Christopher M. Kohlhoff (chris@kohlhoff.com)
|
||||
//
|
||||
@ -12,8 +12,8 @@
|
||||
// no claim as to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#ifndef ASIO_DETAIL_PTHREAD_THREAD_HPP
|
||||
#define ASIO_DETAIL_PTHREAD_THREAD_HPP
|
||||
#ifndef ASIO_DETAIL_POSIX_THREAD_HPP
|
||||
#define ASIO_DETAIL_POSIX_THREAD_HPP
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
@ -29,23 +29,23 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
extern "C" void* asio_detail_pthread_thread_function(void* arg);
|
||||
extern "C" void* asio_detail_posix_thread_function(void* arg);
|
||||
|
||||
class pthread_thread
|
||||
class posix_thread
|
||||
: private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
// Constructor.
|
||||
template <typename Function>
|
||||
pthread_thread(Function f)
|
||||
posix_thread(Function f)
|
||||
: joined_(false)
|
||||
{
|
||||
func_base* arg = new func<Function>(f);
|
||||
::pthread_create(&thread_, 0, asio_detail_pthread_thread_function, arg);
|
||||
::pthread_create(&thread_, 0, asio_detail_posix_thread_function, arg);
|
||||
}
|
||||
|
||||
// Destructor.
|
||||
~pthread_thread()
|
||||
~posix_thread()
|
||||
{
|
||||
if (!joined_)
|
||||
::pthread_detach(thread_);
|
||||
@ -59,7 +59,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
friend void* asio_detail_pthread_thread_function(void* arg);
|
||||
friend void* asio_detail_posix_thread_function(void* arg);
|
||||
|
||||
class func_base
|
||||
{
|
||||
@ -91,10 +91,10 @@ private:
|
||||
bool joined_;
|
||||
};
|
||||
|
||||
inline void* asio_detail_pthread_thread_function(void* arg)
|
||||
inline void* asio_detail_posix_thread_function(void* arg)
|
||||
{
|
||||
pthread_thread::func_base* f =
|
||||
static_cast<pthread_thread::func_base*>(arg);
|
||||
posix_thread::func_base* f =
|
||||
static_cast<posix_thread::func_base*>(arg);
|
||||
f->run();
|
||||
delete f;
|
||||
return 0;
|
||||
@ -107,4 +107,4 @@ inline void* asio_detail_pthread_thread_function(void* arg)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_DETAIL_PTHREAD_THREAD_HPP
|
||||
#endif // ASIO_DETAIL_POSIX_THREAD_HPP
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// pthread_tss_bool.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
// posix_tss_bool.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003 Christopher M. Kohlhoff (chris@kohlhoff.com)
|
||||
//
|
||||
@ -12,8 +12,8 @@
|
||||
// no claim as to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#ifndef ASIO_DETAIL_PTHREAD_TSS_BOOL_HPP
|
||||
#define ASIO_DETAIL_PTHREAD_TSS_BOOL_HPP
|
||||
#ifndef ASIO_DETAIL_POSIX_TSS_BOOL_HPP
|
||||
#define ASIO_DETAIL_POSIX_TSS_BOOL_HPP
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
@ -27,18 +27,18 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
class pthread_tss_bool
|
||||
class posix_tss_bool
|
||||
{
|
||||
public:
|
||||
// Constructor.
|
||||
pthread_tss_bool()
|
||||
posix_tss_bool()
|
||||
{
|
||||
if (::pthread_key_create(&tss_key_, 0) != 0)
|
||||
throw std::runtime_error("Cannot create thread-local storage");
|
||||
}
|
||||
|
||||
// Destructor.
|
||||
~pthread_tss_bool()
|
||||
~posix_tss_bool()
|
||||
{
|
||||
::pthread_key_delete(tss_key_);
|
||||
}
|
||||
@ -74,4 +74,4 @@ private:
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_DETAIL_PTHREAD_TSS_BOOL_HPP
|
||||
#endif // ASIO_DETAIL_POSIX_TSS_BOOL_HPP
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#include "asio/detail/pthread_thread.hpp"
|
||||
#include "asio/detail/posix_thread.hpp"
|
||||
#include "asio/detail/win_thread.hpp"
|
||||
|
||||
namespace asio {
|
||||
@ -26,7 +26,7 @@ namespace detail {
|
||||
#if defined(_WIN32)
|
||||
typedef win_thread thread;
|
||||
#else
|
||||
typedef pthread_thread thread;
|
||||
typedef posix_thread thread;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#include "asio/detail/pthread_tss_bool.hpp"
|
||||
#include "asio/detail/posix_tss_bool.hpp"
|
||||
#include "asio/detail/win_tss_bool.hpp"
|
||||
|
||||
namespace asio {
|
||||
@ -26,7 +26,7 @@ namespace detail {
|
||||
#if defined(_WIN32)
|
||||
typedef win_tss_bool tss_bool;
|
||||
#else
|
||||
typedef pthread_tss_bool tss_bool;
|
||||
typedef posix_tss_bool tss_bool;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
Loading…
Reference in New Issue
Block a user