Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-10-11 12:12:29


>> @@ -38,7 +41,7 @@
>>
>> static void do_once()
>> {
>> - once_callback cb =
>> reinterpret_cast<once_callback>(pthread_getspecific(key)
>> );
>> + once_callback cb =
>> reinterpret_cast<once_callback_wrapper*>(pthread_getspec
>> ific(key))->cb;
>> (*cb)();

This should be:

    static void do_once()
    {
        once_callback_wrapper* wrapper = static_cast<once_callback_wrapper*>
            (pthread_getspecific(key));
        (*wrapper->cb)();
        delete wrapper;
    }

We need to delete the wrapper, and there's no need to resort to
reinterpret_cast.

> Thanks, this saves me the time to work it out myself ;). I'll get
> this patch into CVS before the weeks end.

I wasn't going to say anything before, but if you're going to use this
patch, I suggest my corrected version of do_once.

    -- Darin


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