[Boost-bugs] [Boost C++ Libraries] #10056: boost::promise runs arbitrary code while holding mutex lock

Subject: [Boost-bugs] [Boost C++ Libraries] #10056: boost::promise runs arbitrary code while holding mutex lock
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-16 12:46:31


#10056: boost::promise runs arbitrary code while holding mutex lock
-----------------------------------------------+----------------------
 Reporter: Jonathan Wakely <jwakely.boost@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
-----------------------------------------------+----------------------
 This deadlocks or aborts, depending on how pthreads handles re-locking a
 mutex in the same thread:

 {{{
 #include <boost/thread/future.hpp>

 struct X {
   X() { }
   X(const X&);
 };

 boost::unique_future<X> fut;

 X::X(const X&) { fut.wait_for(boost::chrono::milliseconds(1)); }

 int main()
 {
   boost::promise<X> p;
   fut = p.get_future();
   p.set_value( X() );
 }
 }}}

 promise::set_value() owns a lock while invoking the copy constructor,
 which might have side-effects.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10056>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC