Threads

Ali Çehreli acehreli at yahoo.com
Wed Mar 22 18:00:07 UTC 2023


On 3/21/23 22:30, Tim wrote:
 > to make a simple multi-threading application.

Unless there is a reason not to, I recommend std.concurrency and 
std.parallelism modules. They are different but much more simpler 
compared to the low-level core.thread.

 >      args_copy = args; //Why program name is missing while copy 
arguments?

That doesn't copy. Both args_copy and args will be references to the 
same elements. (They are both array slices.)

The following may work to get a shared argument:

     immutable args_copy = args.idup;

idup makes an immutable copy and immutable is implicitly shared.

Even if that works, I still find std.concurrency much easier to deal 
with. :)

Ali



More information about the Digitalmars-d-learn mailing list