pthread_create()'s behavor?

edA-qa mort-ora-y eda-qa@disemia.com
Mon Apr 16 17:18:00 GMT 2012


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-help/attachments/20120416/3496988d/attachment.sig>


More information about the Libc-help mailing list