[M3devel] Per thread data
Darko
darko at darko.org
Tue Sep 14 14:31:48 CEST 2010
What I'm not clear about in that case is how I get back to the allocated references. Any particular object doesn't know what thread it's running in but needs access to the currently running thread's copy of the objects. If I could subclass Thread.T and have that allocated when creating new threads that would be perfect. I could store a reference in each object pointing to it's per-thread data but that seems wasteful.
On 14/09/2010, at 5:07 AM, Tony Hosking wrote:
> Why not just allocate in the heap and hold a reference in the thread closure?
>
> On 14 Sep 2010, at 00:14, Darko wrote:
>
>> I need to have certain data structures allocated on a per thread basis. Right now I'm thinking of using the thread id from ThreadF.MyId() to index a list. Is there a better, more portable way of allocating on a per-thread basis?
>>
>> Cheers,
>> Darko.
>>
>
More information about the M3devel
mailing list