Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail From: Edek Newsgroups: comp.programming.threads Subject: Re: C++0x, 29.3 p13 "[...] atomic stores visible [...] within a reasonableamount of time." Date: Tue, 05 Jul 2011 11:36:00 +0200 Organization: ATMAN - ATM S.A. Lines: 55 Message-ID: References: <3c50710c-c220-4697-91a7-49b6dc304782@r33g2000prh.googlegroups.com> <4E08D22D.7EB751FB@web.de> <9eceabc4-b9fb-49e3-a917-6986ee00a33e@d26g2000prn.googlegroups.com> <4E12C76D.14571224@web.de> NNTP-Posting-Host: static-81-219-29-192.devs.futuro.pl Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: node2.news.atman.pl 1309858468 5382 81.219.29.192 (5 Jul 2011 09:34:28 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Tue, 5 Jul 2011 09:34:28 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Linux/3.1.0-15 Thunderbird/3.1.0 In-Reply-To: <4E12C76D.14571224@web.de> Xref: x330-a1.tempe.blueboxinc.net comp.programming.threads:384 My understanding is not _that_ shallow. >>> C++0x, 29.3 p13. In draft n3242, the exact text is: >>> "Implementations should make atomic stores visible to atomic loads >>> within a reasonable amount of time." >>> >> >> If you have the time, this point somehow interests me a lot. >> >> To start: does it apply to relaxed only? > > It applies to all stores. Different question: are any stores with a guarantee of better immediacy? > >> >> The main question: Does it apply to release > > Yes. > >> (and acquire/consume)? > > There are no acquire/consume stores. Thread1: store, Thread2: consume. For me these two are a pair; of course these are not stores, these are the points where the store should be visible. > >> (I am ignoring other orderings on purpose, as irrelevant for >> release/acquire, or consume, pair) >> >> What I am basically wondering about, is how to release a lock >> (or anything else blocking another thread) >> in a way that assures it is done 'now' [1]; I care more > > Simply do a store or RMW. The lock acquiring thread will perform an RMW > attempting to acquire the lock. Again: which memory ordering should I use to make a store which will be visible sooner than "within a reasonable amount of time", and which load will see this? Locked RMW on x86_64 will work, but that's not the point. > > regards, > alexander. Thanks, Edek