5
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11
#ifndef ASIO_DETAIL_WIN_EVENT_HPP
12
#define ASIO_DETAIL_WIN_EVENT_HPP
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18
#include "asio/detail/push_options.hpp"
20
#include "asio/detail/push_options.hpp"
21
#include <boost/config.hpp>
22
#include "asio/detail/pop_options.hpp"
24
#if defined(BOOST_WINDOWS)
26
#include "asio/error.hpp"
27
#include "asio/system_error.hpp"
28
#include "asio/detail/noncopyable.hpp"
29
#include "asio/detail/socket_types.hpp"
31
#include "asio/detail/push_options.hpp"
32
#include <boost/assert.hpp>
33
#include <boost/throw_exception.hpp>
34
#include "asio/detail/pop_options.hpp"
45
: event_(::CreateEvent(0, true, false, 0))
49
DWORD last_error = ::GetLastError();
51
asio::error_code(last_error,
52
asio::error::get_system_category()),
54
boost::throw_exception(e);
61
::CloseHandle(event_);
65
template <typename Lock>
66
void signal(Lock& lock)
68
BOOST_ASSERT(lock.locked());
74
template <typename Lock>
75
void clear(Lock& lock)
77
BOOST_ASSERT(lock.locked());
82
// Wait for the event to become signalled.
83
template <typename Lock>
86
BOOST_ASSERT(lock.locked());
88
::WaitForSingleObject(event_, INFINITE);
99
#endif // defined(BOOST_WINDOWS)
101
#include "asio/detail/pop_options.hpp"
103
#endif // ASIO_DETAIL_WIN_EVENT_HPP