|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83795 - in trunk/libs/thread: example test
From: vicente.botet_at_[hidden]
Date: 2013-04-07 14:43:54
Author: viboes
Date: 2013-04-07 14:43:53 EDT (Sun, 07 Apr 2013)
New Revision: 83795
URL: http://svn.boost.org/trac/boost/changeset/83795
Log:
Thread: Added tennis example to regression tests.
Text files modified:
trunk/libs/thread/example/tennis.cpp | 9 ++++-----
trunk/libs/thread/test/Jamfile.v2 | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
Modified: trunk/libs/thread/example/tennis.cpp
==============================================================================
--- trunk/libs/thread/example/tennis.cpp (original)
+++ trunk/libs/thread/example/tennis.cpp 2013-04-07 14:43:53 EDT (Sun, 07 Apr 2013)
@@ -39,11 +39,10 @@
return 0;
}
-void player(void* param)
+void player(int active)
{
boost::unique_lock<boost::mutex> lock(mutex);
- int active = (int)param;
int other = active == PLAYER_A ? PLAYER_B : PLAYER_A;
while (state < GAME_OVER)
@@ -100,8 +99,8 @@
{
state = START;
- boost::thread thrda(thread_adapter(&player, (void*)PLAYER_A));
- boost::thread thrdb(thread_adapter(&player, (void*)PLAYER_B));
+ boost::thread thrda(&player, PLAYER_A);
+ boost::thread thrdb(&player, PLAYER_B);
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC_);
@@ -112,7 +111,7 @@
std::cout << "---Noise ON..." << std::endl;
}
- for (int i = 0; i < 1000000000; ++i)
+ for (int i = 0; i < 10; ++i)
cond.notify_all();
{
Modified: trunk/libs/thread/test/Jamfile.v2
==============================================================================
--- trunk/libs/thread/test/Jamfile.v2 (original)
+++ trunk/libs/thread/test/Jamfile.v2 2013-04-07 14:43:53 EDT (Sun, 07 Apr 2013)
@@ -662,7 +662,7 @@
:
[ thread-run2-noit ../example/monitor.cpp : ex_monitor ]
[ thread-compile ../example/starvephil.cpp : : ex_starvephil ]
- #[ thread-compile ../example/tennis.cpp : : ex_tennis ]
+ [ thread-run2 ../example/tennis.cpp : ex_tennis ]
[ thread-compile ../example/condition.cpp : : ex_condition ]
[ thread-run2-noit ../example/mutex.cpp : ex_mutex ]
[ thread-run2-noit ../example/once.cpp : ex_once ]
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk