Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-06

Re: *** GMX Spamverdacht *** Re: volatile variables

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vinzent Höfler
Michael Schnell wrote 5 lines
On 06/29/2011 03:17 PM, Nikolai Zhubr wrote: > > All places where any non-readonly data could be accessed by 2 or more > threads should be protected. Thats it. So this is not supposed to work:

Precisely, it is not /guaranteed/ to work if that's what you meant.

(Please also note that "give up time slice" does not mean very much on a multi-core/CPU system when the threads are running on different cores/CPUs and thus in "real" parallelity. But I suppose you know that.)

Show quoted text 7 lines
As assigning a value to myList in one thread is only a very short time before the other thread reads it, it's very likely that the wrong value is still be in the cache of the worker thread's processor and make it crash. But is is just a very extreme example of a behavior that mostly is assumed to work and according to your wording would be bound to fail.

Ass-U-Me. You know. ;) - Yes, this is bound to fail.

Vinzent.

Reply by email