Re: Sequenced-Before for g++ 4.1.2?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hei Chan <structurechart@xxxxxxxxx> writes:

> I am still on 4.1.2 (which defaults to use C98), and I wonder whether g++ 4.1.2 guarantees that everything happens before (e.g. write to a variable) will be reflected in another thread if:
> 1. there is no lock (e.g. pthread_mutex/spinlock) involving
> 2. the "another thread" is created (e.g. calling pthread_create) after the "write"

The relevant question for the compiler is whether it will issue all
writes to globally visible memory before calling pthread_create.  The
answer is: yes, it will.

The rest is up to your library.  I would expect that any pthread library
would have a memory barrier during pthread_create, in which case you
should be fine.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux