[Lazarus] thread safe

Andrew Brunner andrew.t.brunner at gmail.com
Tue Jun 28 14:44:03 CEST 2011


2011/6/27 Malcom Haak <insanemal at gmail.com>:

> OF WHAT? bad code? It would only look different if you are looking at
> different parts of memory.. or you hadn't finished writing.

Are you serious?

> Also what the hell are you on about? You could use CriticalSections in your
> example and it would work fine. The fact you have one Thread doing nothing
> for ever is a tad silly and to me shows you have no idea what you are
> doing.. but that could be just because of the exceedingly limited scope of
> the example.

You haven't a clue.

>>
>> Core X computes a=b+c
>> Core X+Y computes a2
>>
> Why would you spilt this into different threads??
> If it is the same thread it does not matter if it moves CPU...
> Your example is lacking in sanity.

This code is written and compiled to execute in thread 1 as per example.

Line T : Core X computes a=b+c
Line T+1 : Core X+Y computes a2

T+1 most likely will be completed before line T is computed!

And it is not poor practice to have threads communicating
reading/writing variables.  Your lack of understanding multi-threaded
systems is evident.

>> This is relatively new theory which required low-level CPU code to
>> perform such locks.  This was never needed until the introduction of
>> multi-core systems.  Of which I did extensive tests on AMD via
>> FPC/Lazarus.
>>
> Yeah your just sounding silly here. As per Reimar Grabowski's comment, whats
> the difference between multi-core and Multi-processor?
> I'll tell you... accessibility to people who don't know what they are on
> about.

No.  I speak with experience.  Whether or not you are able to
learn/comprehend what I am illustrating - that is a different matter.




More information about the Lazarus mailing list