Boost logo

Boost :

Subject: Re: [boost] [threads] Problem with lambda and tls
From: Fu ji (fujimailing_at_[hidden])
Date: 2015-07-13 07:27:33


That's right I replace windows specific api to something cross-platform and
in win there was something like WaitForMultipleEvents check in loop so
there was only one threadid.

Right now I have lambda called from different thread.

Thanks

2015-07-10 14:07 GMT+02:00 Andrey Semashev <andrey.semashev_at_[hidden]>:

> On 10.07.2015 14:54, Fu ji wrote:
>
>> 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.
>>
>
> My guess is that you have these lambdas called in different threads.
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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