|
Threads-Devel : |
Subject: Re: [Threads-devel] "Inside" a thread
From: Anthony Williams (anthony_at_[hidden])
Date: 2010-08-02 11:34:44
On 02/08/10 14:30, Andreas Maier wrote:
> Hi,
> how can I call a method or access a variable of the object "inside" a thread?
> I mean, if I write:
>
> myclass mc;
> thread th(mc);
>
> How can I access myclass now? I tried by doing something with mc, but I think mc will be copied.
Yes, mc will be copied. If you use boost::ref(mc) then it won't be.
Anthony
-- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976