Add io_service::restart() and deprecate io_service::reset().

This commit is contained in:
Christopher Kohlhoff 2014-09-27 16:29:07 +10:00
parent 5126a89879
commit 4b7913379f
22 changed files with 1164 additions and 1141 deletions

View File

@ -173,7 +173,7 @@ public:
endpoint, handler);
ec_ = asio::error::would_block;
this->get_service().get_io_service().reset();
this->get_service().get_io_service().restart();
do this->get_service().get_io_service().run_one();
while (ec_ == asio::error::would_block);
@ -313,7 +313,7 @@ protected:
0, handler);
ec_ = asio::error::would_block;
this->get_service().get_io_service().reset();
this->get_service().get_io_service().restart();
do this->get_service().get_io_service().run_one();
while (ec_ == asio::error::would_block);
if (ec_)
@ -353,7 +353,7 @@ protected:
asio::buffer(&ch, sizeof(char_type)), 0, handler);
ec_ = asio::error::would_block;
this->get_service().get_io_service().reset();
this->get_service().get_io_service().restart();
do this->get_service().get_io_service().run_one();
while (ec_ == asio::error::would_block);
if (ec_)
@ -380,7 +380,7 @@ protected:
asio::buffer(buffer), 0, handler);
ec_ = asio::error::would_block;
this->get_service().get_io_service().reset();
this->get_service().get_io_service().restart();
do this->get_service().get_io_service().run_one();
while (ec_ == asio::error::would_block);
if (ec_)
@ -466,7 +466,7 @@ private:
*i, handler);
ec_ = asio::error::would_block;
this->get_service().get_io_service().reset();
this->get_service().get_io_service().restart();
do this->get_service().get_io_service().run_one();
while (ec_ == asio::error::would_block);

View File

@ -76,7 +76,7 @@ void resolver_service_base::fork_service(
}
else
{
work_io_service_->reset();
work_io_service_->restart();
work_thread_.reset(new asio::detail::thread(
work_io_service_runner(*work_io_service_)));
}

View File

@ -239,7 +239,7 @@ bool task_io_service::stopped() const
return stopped_;
}
void task_io_service::reset()
void task_io_service::restart()
{
mutex::scoped_lock lock(mutex_);
stopped_ = false;

View File

@ -71,8 +71,8 @@ public:
// Determine whether the io_service is stopped.
ASIO_DECL bool stopped() const;
// Reset in preparation for a subsequent run invocation.
ASIO_DECL void reset();
// Restart in preparation for a subsequent run invocation.
ASIO_DECL void restart();
// Notify that some work has started.
void work_started()

View File

@ -83,8 +83,8 @@ public:
return ::InterlockedExchangeAdd(&stopped_, 0) != 0;
}
// Reset in preparation for a subsequent run invocation.
void reset()
// Restart in preparation for a subsequent run invocation.
void restart()
{
::InterlockedExchange(&stopped_, 0);
}

View File

@ -73,6 +73,13 @@ inline bool has_service(io_service& ios)
namespace asio {
#if !defined(ASIO_NO_DEPRECATED)
inline void io_service::reset()
{
restart();
}
#endif // !defined(ASIO_NO_DEPRECATED)
template <typename CompletionHandler>
inline ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ())
io_service::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler)

View File

@ -114,9 +114,9 @@ bool io_service::stopped() const
return impl_.stopped();
}
void io_service::reset()
void io_service::restart()
{
impl_.reset();
impl_.restart();
}
void io_service::notify_fork(asio::io_service::fork_event event)

View File

@ -65,8 +65,8 @@ namespace detail {
*
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Safe, with the specific exceptions of the reset() and
* notify_fork() functions. Calling reset() while there are unfinished run(),
* @e Shared @e objects: Safe, with the specific exceptions of the restart() and
* notify_fork() functions. Calling restart() while there are unfinished run(),
* run_one(), poll() or poll_one() calls results in undefined behaviour. The
* notify_fork() function should not be called while any io_service function,
* or any function on an I/O object that is associated with the io_service, is
@ -96,7 +96,7 @@ namespace detail {
*
* After the exception has been caught, the run(), run_one(), poll() or
* poll_one() call may be restarted @em without the need for an intervening
* call to reset(). This allows the thread to rejoin the io_service object's
* call to restart(). This allows the thread to rejoin the io_service object's
* thread pool without impacting any other threads in the pool.
*
* For example:
@ -259,7 +259,7 @@ public:
* A normal exit from the run() function implies that the io_service object
* is stopped (the stopped() function returns @c true). Subsequent calls to
* run(), run_one(), poll() or poll_one() will return immediately unless there
* is a prior call to reset().
* is a prior call to restart().
*
* @return The number of handlers that were executed.
*
@ -287,7 +287,7 @@ public:
* A normal exit from the run() function implies that the io_service object
* is stopped (the stopped() function returns @c true). Subsequent calls to
* run(), run_one(), poll() or poll_one() will return immediately unless there
* is a prior call to reset().
* is a prior call to restart().
*
* @param ec Set to indicate what error occurred, if any.
*
@ -312,7 +312,7 @@ public:
* implies that the io_service object is stopped (the stopped() function
* returns @c true). Subsequent calls to run(), run_one(), poll() or
* poll_one() will return immediately unless there is a prior call to
* reset().
* restart().
*
* @throws asio::system_error Thrown on failure.
*/
@ -328,7 +328,7 @@ public:
* implies that the io_service object is stopped (the stopped() function
* returns @c true). Subsequent calls to run(), run_one(), poll() or
* poll_one() will return immediately unless there is a prior call to
* reset().
* restart().
*
* @return The number of handlers that were executed.
*/
@ -387,7 +387,7 @@ public:
* This function does not block, but instead simply signals the io_service to
* stop. All invocations of its run() or run_one() member functions should
* return as soon as possible. Subsequent calls to run(), run_one(), poll()
* or poll_one() will return immediately until reset() is called.
* or poll_one() will return immediately until restart() is called.
*/
ASIO_DECL void stop();
@ -403,18 +403,34 @@ public:
*/
ASIO_DECL bool stopped() const;
/// Reset the io_service in preparation for a subsequent run() invocation.
/// Restart the io_service in preparation for a subsequent run() invocation.
/**
* This function must be called prior to any second or later set of
* invocations of the run(), run_one(), poll() or poll_one() functions when a
* previous invocation of these functions returned due to the io_service
* being stopped or running out of work. After a call to reset(), the
* being stopped or running out of work. After a call to restart(), the
* io_service object's stopped() function will return @c false.
*
* This function must not be called while there are any unfinished calls to
* the run(), run_one(), poll() or poll_one() functions.
*/
ASIO_DECL void reset();
ASIO_DECL void restart();
#if !defined(ASIO_NO_DEPRECATED)
/// (Deprecated: Use restart().) Reset the io_service in preparation for a
/// subsequent run() invocation.
/**
* This function must be called prior to any second or later set of
* invocations of the run(), run_one(), poll() or poll_one() functions when a
* previous invocation of these functions returned due to the io_service
* being stopped or running out of work. After a call to restart(), the
* io_service object's stopped() function will return @c false.
*
* This function must not be called while there are any unfinished calls to
* the run(), run_one(), poll() or poll_one() functions.
*/
void reset();
#endif // !defined(ASIO_NO_DEPRECATED)
/// Request the io_service to invoke the given handler.
/**

View File

@ -147,7 +147,7 @@ int main(int argc, char* argv[])
// Run the operations in parallel. This will block until all operations
// have finished, or until the io_service is interrupted. (No threads!)
io_service.reset();
io_service.restart();
io_service.run();
// If the io_service.run() was interrupted then we have received a frame

View File

@ -268,7 +268,7 @@ void test_async_operations()
stream_type server_socket(io_service);
acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
io_service.run();
io_service.reset();
io_service.restart();
const char write_data[]
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@ -281,7 +281,7 @@ void test_async_operations()
asio::buffer(write_buf + bytes_written),
bindns::bind(handle_write, _1, _2, &bytes_written));
io_service.run();
io_service.reset();
io_service.restart();
}
char read_data[sizeof(write_data)];
@ -294,7 +294,7 @@ void test_async_operations()
asio::buffer(read_buf + bytes_read),
bindns::bind(handle_read, _1, _2, &bytes_read));
io_service.run();
io_service.reset();
io_service.restart();
}
ASIO_CHECK(bytes_written == sizeof(write_data));
@ -308,7 +308,7 @@ void test_async_operations()
asio::buffer(write_buf + bytes_written),
bindns::bind(handle_write, _1, _2, &bytes_written));
io_service.run();
io_service.reset();
io_service.restart();
}
bytes_read = 0;
@ -318,7 +318,7 @@ void test_async_operations()
asio::buffer(read_buf + bytes_read),
bindns::bind(handle_read, _1, _2, &bytes_read));
io_service.run();
io_service.reset();
io_service.restart();
}
ASIO_CHECK(bytes_written == sizeof(write_data));

View File

@ -286,7 +286,7 @@ void test_async_operations()
stream_type server_socket(io_service);
acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
io_service.run();
io_service.reset();
io_service.restart();
const char write_data[]
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@ -299,11 +299,11 @@ void test_async_operations()
asio::buffer(write_buf + bytes_written),
bindns::bind(handle_write, _1, _2, &bytes_written));
io_service.run();
io_service.reset();
io_service.restart();
client_socket.async_flush(
bindns::bind(handle_flush, _1));
io_service.run();
io_service.reset();
io_service.restart();
}
char read_data[sizeof(write_data)];
@ -316,7 +316,7 @@ void test_async_operations()
asio::buffer(read_buf + bytes_read),
bindns::bind(handle_read, _1, _2, &bytes_read));
io_service.run();
io_service.reset();
io_service.restart();
}
ASIO_CHECK(bytes_written == sizeof(write_data));
@ -330,11 +330,11 @@ void test_async_operations()
asio::buffer(write_buf + bytes_written),
bindns::bind(handle_write, _1, _2, &bytes_written));
io_service.run();
io_service.reset();
io_service.restart();
server_socket.async_flush(
bindns::bind(handle_flush, _1));
io_service.run();
io_service.reset();
io_service.restart();
}
bytes_read = 0;
@ -344,7 +344,7 @@ void test_async_operations()
asio::buffer(read_buf + bytes_read),
bindns::bind(handle_read, _1, _2, &bytes_read));
io_service.run();
io_service.reset();
io_service.restart();
}
ASIO_CHECK(bytes_written == sizeof(write_data));

View File

@ -275,7 +275,7 @@ void test_async_operations()
stream_type server_socket(io_service);
acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
io_service.run();
io_service.reset();
io_service.restart();
const char write_data[]
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@ -288,11 +288,11 @@ void test_async_operations()
asio::buffer(write_buf + bytes_written),
bindns::bind(handle_write, _1, _2, &bytes_written));
io_service.run();
io_service.reset();
io_service.restart();
client_socket.async_flush(
bindns::bind(handle_flush, _1));
io_service.run();
io_service.reset();
io_service.restart();
}
char read_data[sizeof(write_data)];
@ -305,7 +305,7 @@ void test_async_operations()
asio::buffer(read_buf + bytes_read),
bindns::bind(handle_read, _1, _2, &bytes_read));
io_service.run();
io_service.reset();
io_service.restart();
}
ASIO_CHECK(bytes_written == sizeof(write_data));
@ -319,11 +319,11 @@ void test_async_operations()
asio::buffer(write_buf + bytes_written),
bindns::bind(handle_write, _1, _2, &bytes_written));
io_service.run();
io_service.reset();
io_service.restart();
server_socket.async_flush(
bindns::bind(handle_flush, _1));
io_service.run();
io_service.reset();
io_service.restart();
}
bytes_read = 0;
@ -333,7 +333,7 @@ void test_async_operations()
asio::buffer(read_buf + bytes_read),
bindns::bind(handle_read, _1, _2, &bytes_read));
io_service.run();
io_service.reset();
io_service.restart();
}
ASIO_CHECK(bytes_written == sizeof(write_data));

View File

@ -146,7 +146,7 @@ void deadline_timer_test()
// No completions can be delivered until run() is called.
ASIO_CHECK(count == 3);
ios.reset();
ios.restart();
ios.run();
// The run() call will not return until all operations have finished, and
@ -168,7 +168,7 @@ void deadline_timer_test()
// No completions can be delivered until run() is called.
ASIO_CHECK(count == 0);
ios.reset();
ios.restart();
ios.run();
// The timer should have been cancelled, so count should not have changed.
@ -184,7 +184,7 @@ void deadline_timer_test()
t5.async_wait(boost::bind(increment_if_not_cancelled, &count,
asio::placeholders::error));
ios.reset();
ios.restart();
ios.run();
// The timer should not have been cancelled, so count should have changed.
@ -208,7 +208,7 @@ void deadline_timer_test()
asio::deadline_timer t8(ios, seconds(1));
t8.async_wait(boost::bind(cancel_one_timer, &t7));
ios.reset();
ios.restart();
ios.run();
// One of the waits should not have been cancelled, so count should have

View File

@ -130,7 +130,7 @@ void io_service_test()
ASIO_CHECK(count == 1);
count = 0;
ios.reset();
ios.restart();
ios.post(bindns::bind(increment, &count));
ios.post(bindns::bind(increment, &count));
ios.post(bindns::bind(increment, &count));
@ -148,7 +148,7 @@ void io_service_test()
ASIO_CHECK(count == 5);
count = 0;
ios.reset();
ios.restart();
io_service::work* w = new io_service::work(ios);
ios.post(bindns::bind(&io_service::stop, &ios));
ASIO_CHECK(!ios.stopped());
@ -158,7 +158,7 @@ void io_service_test()
ASIO_CHECK(ios.stopped());
ASIO_CHECK(count == 0);
ios.reset();
ios.restart();
ios.post(bindns::bind(increment, &count));
delete w;
@ -173,7 +173,7 @@ void io_service_test()
ASIO_CHECK(count == 1);
count = 10;
ios.reset();
ios.restart();
ios.post(bindns::bind(decrement_to_zero, &ios, &count));
// No handlers can be called until run() is called.
@ -187,7 +187,7 @@ void io_service_test()
ASIO_CHECK(count == 0);
count = 10;
ios.reset();
ios.restart();
ios.post(bindns::bind(nested_decrement_to_zero, &ios, &count));
// No handlers can be called until run() is called.
@ -201,7 +201,7 @@ void io_service_test()
ASIO_CHECK(count == 0);
count = 10;
ios.reset();
ios.restart();
ios.dispatch(bindns::bind(nested_decrement_to_zero, &ios, &count));
// No handlers can be called until run() is called, even though nested
@ -217,7 +217,7 @@ void io_service_test()
count = 0;
int count2 = 0;
ios.reset();
ios.restart();
ASIO_CHECK(!ios.stopped());
ios.post(bindns::bind(start_sleep_increments, &ios, &count));
ios.post(bindns::bind(start_sleep_increments, &ios, &count2));
@ -234,7 +234,7 @@ void io_service_test()
count = 10;
io_service ios2;
ios.dispatch(ios2.wrap(bindns::bind(decrement_to_zero, &ios2, &count)));
ios.reset();
ios.restart();
ASIO_CHECK(!ios.stopped());
ios.run();
@ -250,7 +250,7 @@ void io_service_test()
count = 0;
int exception_count = 0;
ios.reset();
ios.restart();
ios.post(&throw_exception);
ios.post(bindns::bind(increment, &count));
ios.post(bindns::bind(increment, &count));

View File

@ -553,7 +553,7 @@ void test()
bindns::bind(handle_write_noop,
_1, _2, &write_noop_completed));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(write_noop_completed);
@ -572,7 +572,7 @@ void test()
bindns::bind(handle_write,
_1, _2, &write_completed));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(read_completed);
ASIO_CHECK(write_completed);
@ -586,13 +586,13 @@ void test()
bindns::bind(handle_read_cancel,
_1, _2, &read_cancel_completed));
ios.reset();
ios.restart();
ios.poll();
ASIO_CHECK(!read_cancel_completed);
server_side_socket.cancel();
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(read_cancel_completed);
@ -606,7 +606,7 @@ void test()
server_side_socket.close();
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(read_eof_completed);
}
@ -821,7 +821,7 @@ void test()
acceptor.async_accept(server_side_socket, client_endpoint, &handle_accept);
client_side_socket.async_connect(server_endpoint, &handle_connect);
ios.reset();
ios.restart();
ios.run();
client_side_local_endpoint = client_side_socket.local_endpoint();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -421,7 +421,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb1, 'Z',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -436,7 +436,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb1, 'Z',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -451,7 +451,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb1, 'Z',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -465,7 +465,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb2, 'Z',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -480,7 +480,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb2, 'Z',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -495,7 +495,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb2, 'Z',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -509,7 +509,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb2, 'Y',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -524,7 +524,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb2, 'Y',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -539,7 +539,7 @@ void test_char_async_read_until()
asio::async_read_until(s, sb2, 'Y',
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -550,7 +550,7 @@ void test_char_async_read_until()
int i = asio::async_read_until(s, sb2, 'Y',
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ios.reset();
ios.restart();
ios.run();
}
@ -580,7 +580,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb1, "XYZ",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -595,7 +595,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb1, "XYZ",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -610,7 +610,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb1, "XYZ",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -624,7 +624,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb2, "XYZ",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -639,7 +639,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb2, "XYZ",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -654,7 +654,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb2, "XYZ",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -668,7 +668,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb2, "WXY",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -683,7 +683,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb2, "WXY",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -698,7 +698,7 @@ void test_string_async_read_until()
asio::async_read_until(s, sb2, "WXY",
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -709,7 +709,7 @@ void test_string_async_read_until()
int i = asio::async_read_until(s, sb2, "WXY",
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ios.reset();
ios.restart();
ios.run();
}
@ -739,7 +739,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb1, match_char('Z'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -754,7 +754,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb1, match_char('Z'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -769,7 +769,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb1, match_char('Z'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -783,7 +783,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb2, match_char('Z'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -798,7 +798,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb2, match_char('Z'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -813,7 +813,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb2, match_char('Z'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(ec == asio::error::not_found);
@ -827,7 +827,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb2, match_char('Y'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -842,7 +842,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb2, match_char('Y'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -857,7 +857,7 @@ void test_match_condition_async_read_until()
asio::async_read_until(s, sb2, match_char('Y'),
bindns::bind(async_read_handler, _1, &ec,
_2, &length, &called));
ios.reset();
ios.restart();
ios.run();
ASIO_CHECK(called);
ASIO_CHECK(!ec);
@ -868,7 +868,7 @@ void test_match_condition_async_read_until()
int i = asio::async_read_until(s, sb2, match_char('Y'),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ios.reset();
ios.restart();
ios.run();
}

View File

@ -130,7 +130,7 @@ void strand_test()
ASIO_CHECK(count == 1);
count = 0;
ios.reset();
ios.restart();
s.post(bindns::bind(increment_with_lock, &s, &count));
// No handlers can be called until run() is called.
@ -142,7 +142,7 @@ void strand_test()
ASIO_CHECK(count == 1);
count = 0;
ios.reset();
ios.restart();
ios.post(bindns::bind(start_sleep_increments, &ios, &s, &count));
thread thread1(bindns::bind(io_service_run, &ios));
thread thread2(bindns::bind(io_service_run, &ios));
@ -166,7 +166,7 @@ void strand_test()
count = 0;
int exception_count = 0;
ios.reset();
ios.restart();
s.post(throw_exception);
s.post(bindns::bind(increment, &count));
s.post(bindns::bind(increment, &count));
@ -195,7 +195,7 @@ void strand_test()
ASIO_CHECK(exception_count == 2);
count = 0;
ios.reset();
ios.restart();
// Check for clean shutdown when handlers posted through an orphaned strand
// are abandoned.

View File

@ -163,7 +163,7 @@ void system_timer_test()
// No completions can be delivered until run() is called.
ASIO_CHECK(count == 3);
ios.reset();
ios.restart();
ios.run();
// The run() call will not return until all operations have finished, and
@ -184,7 +184,7 @@ void system_timer_test()
// No completions can be delivered until run() is called.
ASIO_CHECK(count == 0);
ios.reset();
ios.restart();
ios.run();
// The timer should have been cancelled, so count should not have changed.
@ -199,7 +199,7 @@ void system_timer_test()
// wait should run to completion and increment the counter.
t5.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1));
ios.reset();
ios.restart();
ios.run();
// The timer should not have been cancelled, so count should have changed.
@ -221,7 +221,7 @@ void system_timer_test()
asio::system_timer t8(ios, seconds(1));
t8.async_wait(bindns::bind(cancel_one_timer, &t7));
ios.reset();
ios.restart();
ios.run();
// One of the waits should not have been cancelled, so count should have

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff