Boost logo

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.


Author of C++ Concurrency in Action
just::thread C++0x thread library   
Just Software Solutions Ltd
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at