11 #ifndef ASIO_DETAIL_WIN_THREAD_HPP    12 #define ASIO_DETAIL_WIN_THREAD_HPP    14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)    16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)    20 #if defined(ASIO_WINDOWS) && !defined(UNDER_CE)    30 ASIO_DECL unsigned int __stdcall win_thread_function(
void* arg);
    32 #if defined(WINVER) && (WINVER < 0x0500)    33 ASIO_DECL void __stdcall apc_function(ULONG data);
    35 ASIO_DECL void __stdcall apc_function(ULONG_PTR data);
    42   static bool terminate_threads()
    44     return ::InterlockedExchangeAdd(&terminate_threads_, 0) != 0;
    47   static void set_terminate_threads(
bool b)
    49     ::InterlockedExchange(&terminate_threads_, b ? 1 : 0);
    53   static long terminate_threads_;
    57 long win_thread_base<T>::terminate_threads_ = 0;
    60   : 
private noncopyable,
    61     public win_thread_base<win_thread>
    65   template <
typename Function>
    66   win_thread(Function f, 
unsigned int stack_size = 0)
    70     start_thread(
new func<Function>(f), stack_size);
    80   friend ASIO_DECL unsigned int __stdcall win_thread_function(
void* arg);
    82 #if defined(WINVER) && (WINVER < 0x0500)    83   friend ASIO_DECL void __stdcall apc_function(ULONG);
    85   friend ASIO_DECL void __stdcall apc_function(ULONG_PTR);
    91     virtual ~func_base() {}
    92     virtual void run() = 0;
    93     ::HANDLE entry_event_;
    97   struct auto_func_base_ptr
   100     ~auto_func_base_ptr() { 
delete ptr; }
   103   template <
typename Function>
   122   ASIO_DECL void start_thread(func_base* arg, 
unsigned int stack_size);
   125   ::HANDLE exit_event_;
   133 #if defined(ASIO_HEADER_ONLY)   135 #endif // defined(ASIO_HEADER_ONLY)   137 #endif // defined(ASIO_WINDOWS) && !defined(UNDER_CE)   139 #endif // ASIO_DETAIL_WIN_THREAD_HPP 
asio::basic_streambuf< Allocator > & b