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
> > 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?
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