This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthread_create()'s behavor?


On 04/16/2012 07:56 AM, Hei Chan wrote:
> Sometimes (~1% chance), I got a segfault at m_myMap.find(0).  Is it
> true that pthread_create() won't try to enforce the memory barrier to
> ensure all the previous writes to be globally visible?

I can't say why you get a segfault but pthread_create guarantees that
all memory visible to the creating thread at the time of creation is
visible to the created thread. A great deal of programs rely on this
guarantee so if it were broken I'd suspect it would have been found by now.

You can refer to the POSIX guarantee at:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_11

-- 
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]