Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-09-25 11:08:51


From: "Alexander Terekhov" <terekhov_at_[hidden]>
> > This has an even subtler bug. (IMO - I'm not an expert at threading!) No
> > mutex protects pm, so according to POSIX memory visibility rules a
thread
> > can pass through call_once, see that another thread has already executed
> > m_once, and fetch the old value of pm, i.e. zero.
> >
> > Comments? Is the flaw in Boost.Threads or in my limited understanding?
>
> http://groups.google.com/groups?as_umsgid=3AC07BBB.4F52286E%40web.de
> http://groups.google.com/groups?as_umsgid=3AC0A93D.4222518B%40web.de
> http://sources.redhat.com/ml/libc-alpha/2001-04/msg00271.html
> http://sources.redhat.com/ml/libc-alpha/2001-05/msg00019.html

I've read those messages but I think that they don't answer the question
"does pthread_once guarantee memory visibility?"

POSIX says "On return from pthread_once( ), it is guaranteed that
init_routine has completed." Does "completion" imply that the results are
visible to all threads?

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk