Re: handling shared objects

2018-11-26 Thread Alex via Digitalmars-d-learn
On Monday, 26 November 2018 at 16:27:23 UTC, Steven Schveighoffer wrote: On 11/26/18 10:37 AM, Alex wrote: 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 be

Re: handling shared objects

2018-11-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/26/18 10:37 AM, Alex wrote: 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 threa

Re: handling shared objects

2018-11-26 Thread Alex via Digitalmars-d-learn
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 v

Re: handling shared objects

2018-11-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/26/18 10:16 AM, Alex wrote: On Monday, 26 November 2018 at 14:28:33 UTC, Steven Schveighoffer wrote: A static member is stored per thread. If you want a global that's shared between all threads, you need to make it shared. But the result may not be what you are looking for, shared can c

Re: handling shared objects

2018-11-26 Thread Alex via Digitalmars-d-learn
On Monday, 26 November 2018 at 14:28:33 UTC, Steven Schveighoffer wrote: Some problems arose: 1. Obviously, this is not the case, as the output is different, depending on the thread I start the model function. Yes, unless you declare the model to be shared, there is a copy made for each threa

Re: handling shared objects

2018-11-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/26/18 9:00 AM, Alex wrote: Hi all! Can somebody explain to me, why the example below is not working in a way I'm expecting it to work? My example is a little bit longer this time, however the half of it is taken from https://dlang.org/library/std/concurrency/receive_only.html ยดยดยด impo