Passing data and ownership to new thread

James Brister brister at pobox.com
Tue Sep 26 09:10:41 UTC 2017


I'm pretty new to D, but from what I've seen there are two modes 
of using data across threads: (a) immutable message passing and 
the new thread copies the data if it needs to be modified, (b) 
shared, assuming the data will be modified by both threads, and 
the limits that imposes . But why nothing for passing an object 
of some sort to another thread with the ownership moving to the 
new thread. I suppose this would be hard enforce at the language 
level, but wouldn't you want this when trying to pass large-ish 
data structures from one thread to another (thinking of a network 
server, such as a DHCP server, that has a thread for handling the 
network interface and it reads the incoming requests and then 
passes off to another thread to handle).


More information about the Digitalmars-d mailing list