From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6845 invoked by alias); 16 May 2014 00:28:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6758 invoked by uid 48); 16 May 2014 00:28:32 -0000 From: "fawaka at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/60966] std::call_once sometime hangs Date: Fri, 16 May 2014 00:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fawaka at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg01417.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60966 --- Comment #24 from Leon Timmermans --- (In reply to Jonathan Wakely from comment #18) > (In reply to Hideaki Kimura from comment #17) > > Oh, is it the design of promise::get_future/set_value? > > I so far don't see any reference that clarifies either way (most document > > just mentions about difference between future/shared_future) > > It's the same rule to applies to all types in the standard library unless > specified otherwise: concurrent accesses are only safe if they are all reads > (i.e. const operations). Any writes (non-const operations) must be manually > synchronised. > > get_future() is non-const, set_value() is non-const. I can see your point from a C++ point of view, but this doesn't make sense from a usable threading point of view. IMHO, the whole point of abstractions such as promises is to isolate the user from such issues. Leon