[cpp-threads] static locals

Alexander Terekhov alexander.terekhov at gmail.com
Tue May 31 17:05:00 BST 2005


On 5/31/05, Peter Dimov <pdimov at mmltd.net> wrote:
[...]
> Yes, you are right. I thought about "all side effects and all dependencies
> should be visible" but this is too complicated and probably doesn't buy
> anything. So all prior writes it is 

It can be defined "as if" with respect to thread local flag and 
normal mutex (DCSI-TLS/TSD, I mean). Except that...

> (but only in the dynamic initialization case, of course).

Only in the "completed" dynamic initialization case. If it throws, 
__cxa_guard_abort() (in IA64 C++ ABI terms) may be naked (vs 
msync::rel of mutex.unlock()). 

http://www.codesourcery.com/cxx-abi/abi.html#once-ctor

Well, they don't say that, but it oughtta be similar to 
pthread_once() and POSIX thread cancellation (vs normal return 
from the init_routine):

http://www.decadentplace.org.uk/pipermail/cpp-threads_decadentplace.org.uk/2005-April/000222.html

----
There is a happens-before inter-thread ordering with respect 
to preceding (in program and inter-thread order) modifications of 
memory locations in

...

  a thread calling pthread_once() on a specified pthread_once_t 
  object returning from a specified init_routine and accesses to 
  modified memory locations in another thread after that thread 
  returns from pthread_once() on the same pthread_once_t object.

Functions listed above and also pthread_cond_signal() and 
pthread_cond_broadcast() are all side effects.
----

Oder?

regards,
alexander.




More information about the cpp-threads mailing list