Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : gniccolai Date : Sat Feb 19 2005 03:37 pm David Hopwood wrote in message news:... > Giancarlo Niccolai wrote: > > I can try to access any variable from any thread in any moment, in C, > > in C++, or in any language, and there's nothing in the C++ or posix > > standards preventing me from doing it. > > > > # Applications shall ensure that access to any memory location by more than > # one thread of control (threads or processes) is restricted such that no > # thread of control can read or modify a memory location while another > # thread of control may be modifying it. > > (This is strictly speaking for C rather than C++, but if a threading model > were defined for C++ it would presumably have the same restriction. Of > course this doesn't actually *prevent* you from performing such an access, > but it has undefined behaviour in POSIX.) David, I didn't mean HOW I may access the variable. I meant WHEN. I din't say that access must not be guarded somehow (i.e. BY MYSELF), I wrote that I may try the access at ANY MOMENT. Do you read, in the above statement, something about the MOMENT at which I may try a read or a write? Boys, I know I am Italian and trying to express in English, but I am REALLY that misleading when I write? Or are my words just bent to try to deny my reasoning based on the wordings rather than on the underlying concepts? (or are you just getting fun just seeing what I would have replied?) Bests, Gian. P.s. BTW, you dind't cite the part of the article that says: ---- Applications may allow more than one thread of control to read a memory location simultaneously. ---- .