Modify thread-local storage from parent thread

Kai Meyer kai at unixlords.com
Mon Aug 8 11:17:28 PDT 2011


I am playing with threading, and I am doing something like this:
         file.rawRead(bytes);
         auto tmpTask = task!do_something(bytes.idup);
         task_pool.put(tmpTask);
Is there a way to avoid the idup (or can somebody explain why idup here 
is not expensive?)

If the logic above is expressed as:
Read bytes into an array
Create a thread (task) to execute a function that takes a copy of 'bytes'
Execute the thread

I wonder if I could:
Create a thread (task)
Read bytes directly into the tasks' thread local storage
Execute the thread



More information about the Digitalmars-d-learn mailing list