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

Reply via email to