Boost logo

Boost :

Subject: Re: [boost] Boost sprint: #3407 boost::call_once not re-entrant (at least in win32)
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2009-11-25 01:10:43


On Wed, Nov 25, 2009 at 12:59 AM, Gottlob Frege <gottlobfrege_at_[hidden]> wrote:
>> I've checked in a new version on trunk
>>
>> https://svn.boost.org/svn/boost/trunk/boost/thread/win32/once.hpp
>>
> Probably, except you never actually wait on the event! :-)
> (or maybe I missed it).
>
> I'm assuming you mean to wait on it  after the 'waiting' thread
> creates it if it doesn't exist:
>
>            if(!counted)
>            {
>                BOOST_INTERLOCKED_INCREMENT(&flag.count);
>                counted=true;
>                status=::boost::detail::interlocked_read_acquire(&flag.status);
>                if(status==function_complete_flag_value)
>                {
>                    break;
>                }
>
> event_handle=::boost::detail::interlocked_read_acquire(&flag.event_handle);
>                if(!event_handle)
>                {
>
> event_handle=::boost::detail::allocate_event_handle(flag.event_handle);
>                    continue;
>                }
>                ***** Wait(event_handle); ****** ?
>            }
>

Or not quite there, because of the 'continue', but somewhere around there. (?)


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