Re: Synchronize Class fields between different threads

2017-11-10 Thread crimaniak via Digitalmars-d-learn
On Friday, 10 November 2017 at 14:36:03 UTC, DrCataclysm wrote: It is working now. The problem was that the debugger in eclipse ddt seems to completely broken. If i run it directly from bash it is working. Be careful with such statements. Typically, this situation means that there are Heisen

Re: Synchronize Class fields between different threads

2017-11-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 November 2017 at 14:36:03 UTC, DrCataclysm wrote: On Friday, 10 November 2017 at 14:27:41 UTC, bauss wrote: On Friday, 10 November 2017 at 14:13:26 UTC, DrCataclysm wrote: On Friday, 10 November 2017 at 13:50:56 UTC, rikki cattermole wrote: Remember this bit: Everything on the hea

Re: Synchronize Class fields between different threads

2017-11-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 November 2017 at 15:01:30 UTC, bauss wrote: On Friday, 10 November 2017 at 14:36:03 UTC, DrCataclysm wrote: On Friday, 10 November 2017 at 14:27:41 UTC, bauss wrote: On Friday, 10 November 2017 at 14:13:26 UTC, DrCataclysm wrote: [...] _client is allocated in the heap. Socket

Re: Synchronize Class fields between different threads

2017-11-10 Thread DrCataclysm via Digitalmars-d-learn
On Friday, 10 November 2017 at 14:27:41 UTC, bauss wrote: On Friday, 10 November 2017 at 14:13:26 UTC, DrCataclysm wrote: On Friday, 10 November 2017 at 13:50:56 UTC, rikki cattermole wrote: Remember this bit: Everything on the heap, is not thread-local, it is global. This includes everything i

Re: Synchronize Class fields between different threads

2017-11-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 November 2017 at 14:13:26 UTC, DrCataclysm wrote: On Friday, 10 November 2017 at 13:50:56 UTC, rikki cattermole wrote: Remember this bit: Everything on the heap, is not thread-local, it is global. This includes everything inside a class. When you synchronize (statement) it is lo

Re: Synchronize Class fields between different threads

2017-11-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/11/2017 2:13 PM, DrCataclysm wrote: On Friday, 10 November 2017 at 13:50:56 UTC, rikki cattermole wrote: Remember this bit: Everything on the heap, is not thread-local, it is global. This includes everything inside a class. When you synchronize (statement) it is locking and then unlockin

Re: Synchronize Class fields between different threads

2017-11-10 Thread DrCataclysm via Digitalmars-d-learn
On Friday, 10 November 2017 at 13:50:56 UTC, rikki cattermole wrote: Remember this bit: Everything on the heap, is not thread-local, it is global. This includes everything inside a class. When you synchronize (statement) it is locking and then unlocking a mutex. A class has a mutex, simple! It

Re: Synchronize Class fields between different threads

2017-11-10 Thread rikki cattermole via Digitalmars-d-learn
Remember this bit: Everything on the heap, is not thread-local, it is global. This includes everything inside a class. When you synchronize (statement) it is locking and then unlocking a mutex. A class has a mutex, simple! It only prevent multiple threads modifying a single thing at specific t

Synchronize Class fields between different threads

2017-11-10 Thread DrCataclysm via Digitalmars-d-learn
I am trying to understand concurrent/parallel programming with D but i just don't get how i should usesome of the concepts. This is the code i am using to tying out stuff. public class TCPListener { ubyte[] _messageBuffer; Socket _server; Socket _client; // define server in con