2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-28 07:42:12 +00:00

Merged revisions 41399-41442 via svnmerge from

https://svn.boost.org/svn/boost/trunk

........
  r41400 | igaztanaga | 2007-11-26 08:34:13 -0800 (Mon, 26 Nov 2007) | 1 line
  
  Added missing #include <typeinfo>
........
  r41401 | anthonyw | 2007-11-26 09:01:08 -0800 (Mon, 26 Nov 2007) | 1 line
  
  once_flag uses zero-initialization on POSIX as well as windows
........
  r41402 | niels_dekker | 2007-11-26 09:36:52 -0800 (Mon, 26 Nov 2007) | 1 line
  
  Marked value_init_test failures on Borland C++ as "expected failures", as discussed with Fernando Cacciola.
........
  r41404 | rwgk | 2007-11-26 12:46:28 -0800 (Mon, 26 Nov 2007) | 1 line
  
  g++ 4.3.0 compatibility (4.3.0 20071125 (experimental))
........
  r41405 | anthonyw | 2007-11-26 13:15:04 -0800 (Mon, 26 Nov 2007) | 1 line
  
  reverted accidental checkin of new timed_wait functions on condition_variable
........
  r41406 | nasonov | 2007-11-26 13:29:04 -0800 (Mon, 26 Nov 2007) | 3 lines
  
  Remove redundant BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION.
........
  r41407 | chris_kohlhoff | 2007-11-26 13:29:38 -0800 (Mon, 26 Nov 2007) | 3 lines
  
  WinCE doesn't work with all multicast addresses, and even though it doesn't
  support the multicast::enable_loopback option you can still get the value.
........
  r41408 | dave | 2007-11-26 14:01:50 -0800 (Mon, 26 Nov 2007) | 2 lines
  
  Try to extend the workaround to SunPro 5.9, since we're marked as not working on 5.8
........
  r41409 | dave | 2007-11-26 17:40:01 -0800 (Mon, 26 Nov 2007) | 3 lines
  
  Allow Sun-5.7 and Sun-5.8 to fail loudly for Boost.Python so I can see
  what's really wrong.
........
  r41413 | anthonyw | 2007-11-27 06:24:29 -0800 (Tue, 27 Nov 2007) | 1 line
  
  add support for relative timeouts to condition timed_wait
........
  r41414 | grafik | 2007-11-27 09:53:56 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Remove non-existent option info.
........
  r41415 | grafik | 2007-11-27 09:55:13 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Add some utility output formatting functions.
........
  r41416 | grafik | 2007-11-27 09:57:15 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Check empty string invariants, instead of assuming all strings are allocated. And reset strings when they are freed.
........
  r41417 | grafik | 2007-11-27 09:58:50 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Fix buffer overrun bug in expanding @() subexpressions.
........
  r41418 | hkaiser | 2007-11-27 10:18:10 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Wave: Fixed gcc warning, bumped version number.
........
  r41419 | djenkins | 2007-11-27 10:57:48 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Changes for msvc-9.0 /clr flag
........
  r41420 | djenkins | 2007-11-27 10:59:06 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Changes for msvc-9.0 /clr flag
........
  r41423 | niels_dekker | 2007-11-27 13:34:08 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Added value_init test for struct as used in MSVC bug report regarding value-initialization.
........
  r41429 | noel_belcourt | 2007-11-27 18:27:13 -0800 (Tue, 27 Nov 2007) | 3 lines
  
  Fix pathscale rpath issue per Alain Minussi's suggestion.
........
  r41430 | grafik | 2007-11-27 23:08:13 -0800 (Tue, 27 Nov 2007) | 1 line
  
  Add test for result status values of simple actions, i.e. empty actions.
........
  r41431 | grafik | 2007-11-27 23:21:49 -0800 (Tue, 27 Nov 2007) | 19 lines
  
  build-system.jam
  * Reflect added start/end timestamps for actions in xml output. And update action rules for new args.
  
  execcmd.h
  * Add start/end timestamps to action timing info.
  
  execnt.c
  * Fix filetime_seconds calculation when time is larger than low 32 bit value.
  * Add calc of C time_t from Windows FILETIME.
  * Add start/end timestamps recording to action timing info.
  
  execunix.c
  * Add start/end timestamps recording to action timing info.
  
  jam.c
  * Change JAMDATE to use common ISO date format.
  
  make1.c
  * Redo __TIMING_RULE__ and __ACTION__RULE__ invocations to new argument ordering and added end/result timestamp values.
........
  r41432 | chris_kohlhoff | 2007-11-28 05:26:33 -0800 (Wed, 28 Nov 2007) | 3 lines
  
  Make async operations fail with an error if the socket descriptor doesn't
  fit into the select call's fd_set.
........
  r41433 | bgubenko | 2007-11-28 07:33:16 -0800 (Wed, 28 Nov 2007) | 1 line
  
  add "gcc*hpux*" toolset for serialization library bug on big endian platforms
........
  r41436 | niels_dekker | 2007-11-28 09:19:37 -0800 (Wed, 28 Nov 2007) | 1 line
  
  Added tests for two more struct types to value_init_test -- discussed with Fernando Cacciola
........
  r41439 | bgubenko | 2007-11-28 11:04:53 -0800 (Wed, 28 Nov 2007) | 1 line
  
  add "<linkflags>-lrt" for acc* toolsets
........
  r41440 | grafik | 2007-11-28 12:24:17 -0800 (Wed, 28 Nov 2007) | 1 line
  
  Fix for latest Doxygen namespace file names. And support for method groups. From Samuel Debionne.
........


[SVN r41444]
This commit is contained in:
Eric Niebler
2007-11-28 22:03:59 +00:00
parent 7391910d54
commit 2a1e4496ba
7 changed files with 189 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
// Copyright (C) 2001-2003
// William E. Kempf
// Copyright (C) 2007 Anthony Williams
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,7 +20,7 @@ struct condition_test_data
condition_test_data() : notified(0), awoken(0) { }
boost::mutex mutex;
boost::condition condition;
boost::condition_variable condition;
int notified;
int awoken;
};
@@ -82,6 +83,15 @@ void condition_test_waits(condition_test_data* data)
BOOST_CHECK_EQUAL(data->notified, 4);
data->awoken++;
data->condition.notify_one();
// Test predicate timed_wait with relative timeout
cond_predicate pred_rel(data->notified, 5);
BOOST_CHECK(data->condition.timed_wait(lock, boost::posix_time::seconds(10), pred_rel));
BOOST_CHECK(lock ? true : false);
BOOST_CHECK(pred_rel());
BOOST_CHECK_EQUAL(data->notified, 5);
data->awoken++;
data->condition.notify_one();
}
void do_test_condition_notify_one()
@@ -185,10 +195,19 @@ void do_test_condition_waits()
data.condition.wait(lock);
BOOST_CHECK(lock ? true : false);
BOOST_CHECK_EQUAL(data.awoken, 4);
boost::thread::sleep(delay(1));
data.notified++;
data.condition.notify_one();
while (data.awoken != 5)
data.condition.wait(lock);
BOOST_CHECK(lock ? true : false);
BOOST_CHECK_EQUAL(data.awoken, 5);
}
thread.join();
BOOST_CHECK_EQUAL(data.awoken, 4);
BOOST_CHECK_EQUAL(data.awoken, 5);
}
void test_condition_waits()
@@ -216,6 +235,32 @@ void test_condition_wait_is_a_interruption_point()
timed_test(&do_test_condition_wait_is_a_interruption_point, 1);
}
bool fake_predicate()
{
return false;
}
void do_test_timed_wait_times_out()
{
boost::condition_variable cond;
boost::mutex m;
boost::posix_time::seconds const delay(5);
boost::mutex::scoped_lock lock(m);
boost::system_time const start=boost::get_system_time();
bool const res=cond.timed_wait(lock,delay,fake_predicate);
boost::system_time const end=boost::get_system_time();
BOOST_CHECK(!res);
BOOST_CHECK((delay-boost::posix_time::milliseconds(10))<=(end-start));
}
void test_timed_wait_times_out()
{
timed_test(&do_test_timed_wait_times_out, 15);
}
boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[])
{
@@ -226,6 +271,7 @@ boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[])
test->add(BOOST_TEST_CASE(&test_condition_notify_all));
test->add(BOOST_TEST_CASE(&test_condition_waits));
test->add(BOOST_TEST_CASE(&test_condition_wait_is_a_interruption_point));
test->add(BOOST_TEST_CASE(&test_timed_wait_times_out));
return test;
}