Boost logo

Boost :

Subject: [boost] [threads] Problem with lambda and tls
From: Fu ji (fujimailing_at_[hidden])
Date: 2015-07-10 07:54:08


Hello,
I have a problem when I use lambda in lambda and I want to obtain thread
local storage. Here is simple example:

auto late_connect = wakeup_signal_notify_to_connect.connect([this](){
    auto* alias_to_this = this;

    this->OnInvokeUpdate(); //here I can obtain thread local storage from boost

    auto wakeup = wakeup_signal_ptr->connect([alias_to_this]()
    {
            alias_to_this->OnInvokeUpdate(); //here I cannot obtain
thread local storage from boost
        }
    });});

Between first and second of invoke OnInvokeUpdate function there was no
destructor call.
Someone have idei why ? If I don't use alias for this in capture list there
is the same effet.

Best regards


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