Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85663 - in branches/release: boost/thread boost/thread/win32 libs/thread/doc libs/thread/example libs/thread/test
From: vicente.botet_at_[hidden]
Date: 2013-09-13 15:01:48


Author: viboes
Date: 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013)
New Revision: 85663
URL: http://svn.boost.org/trac/boost/changeset/85663

Log:
Thread: merge scoped_thread constr + condition_variable timed wait issues on windows + doc typos.

Added:
   branches/release/libs/thread/test/test_9079_a.cpp
      - copied unchanged from r85611, trunk/libs/thread/test/test_9079_a.cpp
   branches/release/libs/thread/test/test_9079_b.cpp
      - copied unchanged from r85611, trunk/libs/thread/test/test_9079_b.cpp
Text files modified:
   branches/release/boost/thread/scoped_thread.hpp | 10 +--
   branches/release/boost/thread/win32/condition_variable.hpp | 19 ++++++++
   branches/release/libs/thread/doc/changes.qbk | 10 +++-
   branches/release/libs/thread/doc/configuration.qbk | 8 +-
   branches/release/libs/thread/doc/external_locking.qbk | 2
   branches/release/libs/thread/doc/scoped_thread.qbk | 4
   branches/release/libs/thread/doc/sync_tutorial.qbk | 4
   branches/release/libs/thread/doc/thread_ref.qbk | 10 ++--
   branches/release/libs/thread/example/not_interleaved.cpp | 4
   branches/release/libs/thread/example/producer_consumer.cpp | 6 +-
   branches/release/libs/thread/example/producer_consumer_bounded.cpp | 6 +-
   branches/release/libs/thread/example/scoped_thread.cpp | 8 +++
   branches/release/libs/thread/test/Jamfile.v2 | 4 +
   branches/release/libs/thread/test/test_9079_a.cpp | 57 ++++++++++++++++++++++++++++
   branches/release/libs/thread/test/test_9079_b.cpp | 81 ++++++++++++++++++++++++++++++++++++++++
   15 files changed, 198 insertions(+), 35 deletions(-)

Modified: branches/release/boost/thread/scoped_thread.hpp
==============================================================================
--- branches/release/boost/thread/scoped_thread.hpp Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/boost/thread/scoped_thread.hpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -47,9 +47,8 @@
      *
      */
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- template <class F, class ...Args>
- explicit strict_scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args,
- typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0) :
+ template <class F, class ...Args, typename = typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type>
+ explicit strict_scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args) :
       t_(boost::forward<F>(f), boost::forward<Args>(args)...) {}
 #else
     template <class F>
@@ -138,9 +137,8 @@
      */
 
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- template <class F, class ...Args>
- explicit scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args,
- typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0) :
+ template <class F, class ...Args, typename = typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type>
+ explicit scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args) :
       t_(boost::forward<F>(f), boost::forward<Args>(args)...) {}
 #else
     template <class F>

Modified: branches/release/boost/thread/win32/condition_variable.hpp
==============================================================================
--- branches/release/boost/thread/win32/condition_variable.hpp Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/boost/thread/win32/condition_variable.hpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -366,7 +366,11 @@
                 const chrono::time_point<Clock, Duration>& t)
         {
           using namespace chrono;
- do_wait(lock, ceil<milliseconds>(t-Clock::now()).count());
+ chrono::time_point<Clock, Duration> now = Clock::now();
+ if (t<=now) {
+ return cv_status::timeout;
+ }
+ do_wait(lock, ceil<milliseconds>(t-now).count());
           return Clock::now() < t ? cv_status::no_timeout :
                                              cv_status::timeout;
         }
@@ -378,6 +382,10 @@
                 const chrono::duration<Rep, Period>& d)
         {
           using namespace chrono;
+ if (d<=chrono::duration<Rep, Period>::zero()) {
+ return cv_status::timeout;
+ }
+
           steady_clock::time_point c_now = steady_clock::now();
           do_wait(lock, ceil<milliseconds>(d).count());
           return steady_clock::now() - c_now < d ? cv_status::no_timeout :
@@ -479,7 +487,11 @@
                 const chrono::time_point<Clock, Duration>& t)
         {
           using namespace chrono;
- do_wait(lock, ceil<milliseconds>(t-Clock::now()).count());
+ chrono::time_point<Clock, Duration> now = Clock::now();
+ if (t<=now) {
+ return cv_status::timeout;
+ }
+ do_wait(lock, ceil<milliseconds>(t-now).count());
           return Clock::now() < t ? cv_status::no_timeout :
                                              cv_status::timeout;
         }
@@ -491,6 +503,9 @@
                 const chrono::duration<Rep, Period>& d)
         {
           using namespace chrono;
+ if (d<=chrono::duration<Rep, Period>::zero()) {
+ return cv_status::timeout;
+ }
           steady_clock::time_point c_now = steady_clock::now();
           do_wait(lock, ceil<milliseconds>(d).count());
           return steady_clock::now() - c_now < d ? cv_status::no_timeout :

Modified: branches/release/libs/thread/doc/changes.qbk
==============================================================================
--- branches/release/libs/thread/doc/changes.qbk Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/doc/changes.qbk 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -8,7 +8,6 @@
 
 [section:changes History]
 
-[/]
 [heading Version 4.2.0 - boost 1.55]
 
 [*New Features:]
@@ -17,15 +16,20 @@
 * [@http://svn.boost.org/trac/boost/ticket/8518 #8518] Synchro: Add a latch class.
 * [@http://svn.boost.org/trac/boost/ticket/8519 #8519] Synchro: Update class barrier with a completion function.
 
-* [@http://svn.boost.org/trac/boost/ticket/8615 #8615] Async: Replace make_future/make_shared_future by make_ready_future.
 * [@http://svn.boost.org/trac/boost/ticket/8515 #8515] Async: Add shared_future::then.
+* [@http://svn.boost.org/trac/boost/ticket/8615 #8615] Async: Replace make_future/make_shared_future by make_ready_future.
 * [@http://svn.boost.org/trac/boost/ticket/8627 #8627] Async: Add future<>::unwrap and unwrapping constructor.
 * [@http://svn.boost.org/trac/boost/ticket/8677 #8677] Async: Add future<>::get_or.
 * [@http://svn.boost.org/trac/boost/ticket/8678 #8678] Async: Add future<>::fallback_to.
 
+* [@http://svn.boost.org/trac/boost/ticket/8891 #8891] upgrade_to_unique_lock: missing mutex() function
+
 [*Fixed Bugs:]
 
-[/]
+* [@http://svn.boost.org/trac/boost/ticket/8931 #8931] Typos in external_locking reference
+* [@http://svn.boost.org/trac/boost/ticket/9029 #9029] Misprint in documentation
+* [@http://svn.boost.org/trac/boost/ticket/9037 #9037] [thread] gcc -Wshadow gives warnings in condition_variable{,_fwd}.hpp
+* [@http://svn.boost.org/trac/boost/ticket/9041 #9041] [thread] Boost.Thread DSO's may need to link with Boost.Atomic
 
 [heading Version 4.1.0 - boost 1.54]
 

Modified: branches/release/libs/thread/doc/configuration.qbk
==============================================================================
--- branches/release/libs/thread/doc/configuration.qbk Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/doc/configuration.qbk 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -91,15 +91,15 @@
 
 The following operators are deprecated:
 
-* `boost::thread::oprator==`
-* `boost::thread::oprator!=`
+* `boost::thread::operator==`
+* `boost::thread::operator!=`
 
 When `BOOST_THREAD_PROVIDES_THREAD_EQ` is defined Boost.Thread provides these deprecated feature.
 
 Use instead
 
-* `boost::thread::id::oprator==`
-* `boost::thread::id::oprator!=`
+* `boost::thread::id::operator==`
+* `boost::thread::id::operator!=`
 
 [warning This is a breaking change respect to version 1.x.]
 

Modified: branches/release/libs/thread/doc/external_locking.qbk
==============================================================================
--- branches/release/libs/thread/doc/external_locking.qbk Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/doc/external_locking.qbk 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -482,7 +482,7 @@
 
 In order to make this code compilable we need to store either a Lockable or a `unique_lock<Lockable>` reference depending on the constructor. Store which kind of reference we have stored,and in the destructor call either to the Lockable `unlock` or restore the ownership.
 
-This seams too complicated to me. Another possibility is to define a nested strict lock class. The drawback is that instead of having only one strict lock we have two and we need either to duplicate every function taking a `strict_lock` or make these function templates functions. The problem with template functions is that we don't profit anymore of the C++ type system. We must add some static metafunction that check that the Locker parameter is a strict lock. The problem is that we can not really check this or can we?. The `is_strict_lock` metafunction must be specialized by the strict lock developer. We need to belive it "sur parole". The advantage is that now we can manage with more than two strict locks without changing our code. Ths is really nice.
+This seams too complicated to me. Another possibility is to define a nested strict lock class. The drawback is that instead of having only one strict lock we have two and we need either to duplicate every function taking a `strict_lock` or make these function templates functions. The problem with template functions is that we don't profit anymore of the C++ type system. We must add some static metafunction that check that the Locker parameter is a strict lock. The problem is that we can not really check this or can we?. The `is_strict_lock` metafunction must be specialized by the strict lock developer. We need to belive it "sur parole". The advantage is that now we can manage with more than two strict locks without changing our code. This is really nice.
 
 Now we need to state that both classes are `strict_lock`s.
 

Modified: branches/release/libs/thread/doc/scoped_thread.qbk
==============================================================================
--- branches/release/libs/thread/doc/scoped_thread.qbk Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/doc/scoped_thread.qbk 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -190,7 +190,7 @@
 
         explicit scoped_thread(thread&& th) noexcept;
         template <typename F&&, typename ...Args>
- explicit strict_scoped_thread(F&&, Args&&...);
+ explicit scoped_thread(F&&, Args&&...);
 
         ~scoped_thread();
 
@@ -323,7 +323,7 @@
 [section:call_constructor Move Constructor from a Callable]
 
         template <typename F&&, typename ...Args>
- explicit strict_scoped_thread(F&&, Args&&...);
+ explicit scoped_thread(F&&, Args&&...);
 
 [variablelist
 

Modified: branches/release/libs/thread/doc/sync_tutorial.qbk
==============================================================================
--- branches/release/libs/thread/doc/sync_tutorial.qbk Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/doc/sync_tutorial.qbk 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -23,9 +23,9 @@
 In particular, the library provides some lock factories.
 
   template <class Lockable, class Function>
- auto with_lock_guard(Lockable& m, Function f) -> decltype(fn())
+ auto with_lock_guard(Lockable& m, Function f) -> decltype(f())
   {
- auto&& _ = boost::make_lock_guard(f);
+ auto&& _ = boost::make_lock_guard(m);
     f();
   }
 

Modified: branches/release/libs/thread/doc/thread_ref.qbk
==============================================================================
--- branches/release/libs/thread/doc/thread_ref.qbk Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/doc/thread_ref.qbk 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -568,7 +568,7 @@
 
 [variablelist
 
-[[Requires:] [`Callable` must by Copyable and `func()` must be a valid expression.]]
+[[Requires:] [`Callable` must be Copyable and `func()` must be a valid expression.]]
 
 [[Effects:] [`func` is copied into storage managed internally by the thread library, and that copy is invoked on a newly-created
 thread of execution. If this invocation results in an exception being propagated into the internals of the thread library that is
@@ -595,7 +595,7 @@
 
 [variablelist
 
-[[Preconditions:] [`Callable` must by copyable.]]
+[[Preconditions:] [`Callable` must be copyable.]]
 
 [[Effects:] [`func` is copied into storage managed internally by the thread library, and that copy is invoked on a newly-created
 thread of execution with the specified attributes. If this invocation results in an exception being propagated into the internals of the thread library that is
@@ -623,7 +623,7 @@
 
 [variablelist
 
-[[Preconditions:] [`Callable` must by Movable.]]
+[[Preconditions:] [`Callable` must be Movable.]]
 
 [[Effects:] [`func` is moved into storage managed internally by the thread library, and that copy is invoked on a newly-created
 thread of execution. If this invocation results in an exception being propagated into the internals of the thread library that is
@@ -650,7 +650,7 @@
 
 [variablelist
 
-[[Preconditions:] [`Callable` must by copyable.]]
+[[Preconditions:] [`Callable` must be copyable.]]
 
 [[Effects:] [`func` is copied into storage managed internally by the thread library, and that copy is invoked on a newly-created
 thread of execution with the specified attributes. If this invocation results in an exception being propagated into the internals of the thread library that is
@@ -679,7 +679,7 @@
 
 [variablelist
 
-[[Preconditions:] [`F` and each `A`n must by copyable or movable.]]
+[[Preconditions:] [`F` and each `A`n must be copyable or movable.]]
 
 [[Effects:] [As if [link
 thread.thread_management.thread.callable_constructor

Modified: branches/release/libs/thread/example/not_interleaved.cpp
==============================================================================
--- branches/release/libs/thread/example/not_interleaved.cpp Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/example/not_interleaved.cpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -44,8 +44,8 @@
   externally_locked_stream<std::ostream> mcout(std::cout, terminal_mutex);
   externally_locked_stream<std::istream> mcin(std::cin, terminal_mutex);
 
- scoped_thread<> t1(thread(use_cerr, boost::ref(mcerr)));
- scoped_thread<> t2(thread(use_cout, boost::ref(mcout)));
+ scoped_thread<> t1(boost::thread(use_cerr, boost::ref(mcerr)));
+ scoped_thread<> t2(boost::thread(use_cout, boost::ref(mcout)));
   this_thread::sleep_for(chrono::seconds(2));
   std::string nm;
   {

Modified: branches/release/libs/thread/example/producer_consumer.cpp
==============================================================================
--- branches/release/libs/thread/example/producer_consumer.cpp Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/example/producer_consumer.cpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -110,9 +110,9 @@
 
   {
     mcout << "begin of main" << std::endl;
- scoped_thread<> t11(thread(producer, boost::ref(mcerr), boost::ref(sbq)));
- scoped_thread<> t12(thread(producer, boost::ref(mcerr), boost::ref(sbq)));
- scoped_thread<> t2(thread(consumer, boost::ref(mcout), boost::ref(sbq)));
+ scoped_thread<> t11(boost::thread(producer, boost::ref(mcerr), boost::ref(sbq)));
+ scoped_thread<> t12(boost::thread(producer, boost::ref(mcerr), boost::ref(sbq)));
+ scoped_thread<> t2(boost::thread(consumer, boost::ref(mcout), boost::ref(sbq)));
 
     this_thread::sleep_for(chrono::seconds(1));
 

Modified: branches/release/libs/thread/example/producer_consumer_bounded.cpp
==============================================================================
--- branches/release/libs/thread/example/producer_consumer_bounded.cpp Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/example/producer_consumer_bounded.cpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -110,9 +110,9 @@
 
   {
     mcout << "begin of main" << std::endl;
- scoped_thread<> t11(thread(producer, boost::ref(mcerr), boost::ref(sbq)));
- scoped_thread<> t12(thread(producer, boost::ref(mcerr), boost::ref(sbq)));
- scoped_thread<> t2(thread(consumer, boost::ref(mcout), boost::ref(sbq)));
+ scoped_thread<> t11(boost::thread(producer, boost::ref(mcerr), boost::ref(sbq)));
+ scoped_thread<> t12(boost::thread(producer, boost::ref(mcerr), boost::ref(sbq)));
+ scoped_thread<> t2(boost::thread(consumer, boost::ref(mcout), boost::ref(sbq)));
 
     this_thread::sleep_for(chrono::seconds(1));
 

Modified: branches/release/libs/thread/example/scoped_thread.cpp
==============================================================================
--- branches/release/libs/thread/example/scoped_thread.cpp Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/example/scoped_thread.cpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -13,6 +13,9 @@
 {
   ++i;
 }
+void f(int, int)
+{
+}
 
 struct func
 {
@@ -81,7 +84,10 @@
 
     do_something_in_current_thread();
   }
-
+ {
+ boost::scoped_thread<> g( f, 1, 2 );
+ do_something_in_current_thread();
+ }
   return 0;
 }
 

Modified: branches/release/libs/thread/test/Jamfile.v2
==============================================================================
--- branches/release/libs/thread/test/Jamfile.v2 Fri Sep 13 12:45:52 2013 (r85662)
+++ branches/release/libs/thread/test/Jamfile.v2 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663)
@@ -792,7 +792,9 @@
           #[ thread-run test_8600.cpp ]
           #[ thread-run test_8943.cpp ]
           #[ thread-run test_8960.cpp ]
-
+ [ thread-run test_9079_a.cpp ]
+ [ thread-run test_9079_b.cpp ]
+
     ;
 
 }

Copied: branches/release/libs/thread/test/test_9079_a.cpp (from r85611, trunk/libs/thread/test/test_9079_a.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_9079_a.cpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663, copy of r85611, trunk/libs/thread/test/test_9079_a.cpp)
@@ -0,0 +1,57 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+// A
+
+//#include <boost/log/trivial.hpp>
+#include <boost/chrono.hpp>
+#include <boost/thread.hpp>
+#include <boost/thread/condition_variable.hpp>
+
+//#if !defined(BOOST_NO_CXX11_ALIGNAS)
+//#error
+//# define BOOST_ALIGNMENT2(x) alignas(x)
+//#elif defined(_MSC_VER)
+//#error
+//# define BOOST_ALIGNMENT2(x) __declspec(align(x))
+//#elif defined(__GNUC__)
+//#error
+//# define BOOST_ALIGNMENT(x) __attribute__ ((__aligned__(x)))
+//#else
+//#error
+//# define BOOST_NO_ALIGNMENT2
+//# define BOOST_ALIGNMENT2(x)
+//#endif
+
+typedef boost::chrono::high_resolution_clock Clock;
+typedef Clock::time_point TimePoint;
+
+inline TimePoint real_time_now()
+{
+ return Clock::now();
+}
+
+int main()
+{
+ using namespace boost::chrono;
+
+ boost::condition_variable m_task_spawn_condition;
+
+ boost::mutex main_thread_mutex;
+ boost::unique_lock < boost::mutex > main_thread_lock(main_thread_mutex);
+
+ //BOOST_LOG_TRIVIAL(info) << "[TaskScheduler::run_and_wait] Scheduling loop - BEGIN";
+
+ //while (true)
+ {
+ static const milliseconds TIME_BACK = milliseconds(1);
+ m_task_spawn_condition.wait_until(
+ main_thread_lock,
+ real_time_now() - TIME_BACK); // wait forever
+ m_task_spawn_condition.wait_for( main_thread_lock, - TIME_BACK ); // same problem
+ //BOOST_LOG_TRIVIAL(trace) << "TICK";
+ }
+
+}

Copied: branches/release/libs/thread/test/test_9079_b.cpp (from r85611, trunk/libs/thread/test/test_9079_b.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/thread/test/test_9079_b.cpp 2013-09-13 15:01:48 EDT (Fri, 13 Sep 2013) (r85663, copy of r85611, trunk/libs/thread/test/test_9079_b.cpp)
@@ -0,0 +1,81 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// 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)
+
+// B
+
+#include <boost/atomic.hpp>
+//#include <boost/log/trivial.hpp>
+#include <boost/chrono.hpp>
+#include <boost/thread.hpp>
+#include <boost/thread/condition_variable.hpp>
+
+typedef boost::chrono::high_resolution_clock Clock;
+typedef Clock::time_point TimePoint;
+
+inline TimePoint real_time_now()
+{
+ return Clock::now();
+}
+
+class Foo {
+ boost::atomic<bool> m_is_exiting;
+ TimePoint m_next_tick_time;
+
+public:
+
+ bool is_exiting() const
+ {
+ return m_is_exiting;
+ }
+
+ TimePoint spawn_tasks() // note that in my app, this call takes more time than here
+ {
+ using namespace boost::chrono;
+ const TimePoint now = real_time_now();
+
+ if (m_next_tick_time < now) {
+ m_next_tick_time = now + seconds(1);
+ //BOOST_LOG_TRIVIAL(info) << "TICK!";
+ }
+
+ return m_next_tick_time;
+ }
+
+};
+
+int main()
+{
+ using namespace boost::chrono;
+ static const milliseconds MIN_TIME_TASKS_SPAWN_FREQUENCY = milliseconds(1);
+ //microseconds(1); // THE SHORTER THE QUICKER TO REPRODUCE THE BUG
+
+ boost::condition_variable m_task_spawn_condition;
+ Foo foo;
+
+ boost::mutex main_thread_mutex;
+ boost::unique_lock < boost::mutex > main_thread_lock(main_thread_mutex);
+
+ //BOOST_LOG_TRIVIAL(info) << "[TaskScheduler::run_and_wait] Scheduling loop - BEGIN";
+
+ while (!foo.is_exiting()) {
+ const TimePoint next_task_spawn_time = foo.spawn_tasks();
+
+ const TimePoint now = real_time_now();
+ const TimePoint next_minimum_spawn_time = now + MIN_TIME_TASKS_SPAWN_FREQUENCY;
+ const TimePoint next_spawn_time = next_task_spawn_time > TimePoint()
+ && next_task_spawn_time < next_minimum_spawn_time
+ ? next_task_spawn_time : next_minimum_spawn_time;
+
+ const TimePoint::duration wait_time = next_spawn_time - now;
+ if (wait_time > wait_time.zero()) {
+ // BOOST_LOG_TRIVIAL(trace) << "WAIT TIME: " << wait_time; // UNCOMMENT THIS: MAKES IT WORKS. WAT??????
+ m_task_spawn_condition.wait_until(
+ main_thread_lock,
+ next_spawn_time); // DON'T WORK: WILL WAIT IF next_spawn_time is too close!
+ }
+
+ }
+
+}


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