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

Subject: Re: [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-19 13:31:16


#10056: boost::promise runs arbitrary code while holding mutex lock
------------------------------------------------+----------------------
  Reporter: Jonathan Wakely <jwakely.boost@…> | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------------------+----------------------

Comment (by Jonathan Wakely <jwakely.boost@…>):

 It's a bit contrived, yes, but this is reduced to the minimum needed to
 show it.

 IMHO it's conceivable that the result's copy constructor would try to do
 something (e.g. logging or performance measurements) which might end up
 checking for readiness of something, which depends on the result we're
 initializing.

 The standard doesn't say anything about this, which I interpret to mean
 it's supposed to work. Otherwise I would expect the standard to place
 preconditions on promise::set_value(). Since I interpret it that way, GCC
 does not deadlock for code like this (no lock is held which the result
 object is copied). libc++ either deadlocks or aborts depending on the
 Pthreads implementation (attempting to lock a mutex in the thread that
 already owns it is undefined behaviour).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10056#comment:2>
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