handling shared objects

Alex sascha.orlov at gmail.com
Mon Nov 26 15:37:01 UTC 2018


On Monday, 26 November 2018 at 15:26:43 UTC, Steven Schveighoffer 
wrote:
>
> Well, if you want to run calculations in another thread, then 
> send the result back to the original, you may be better off 
> sending the state needed for the calculation to the worker 
> thread, and receiving the result back via the messaging system.

How to do this, if parts of the state are statically saved in a 
type?

> Note that if you want to do it without safety in place, you can 
> use the Thread class in core.thread which has no requirements 
> for data to be immutable or shared. But you have to be even 
> more careful about how you access the data.
>

Ah... ok. But then, I will prefer to mark the appropriate parts 
as shared, I think...


More information about the Digitalmars-d-learn mailing list