On 22/06/2011 23:37, Malcom Haak wrote:
Correct me if I'm wrong, But can't you technically make any code 'thread-safe' by using Critical Sections before doing work.

I don't think so.

If the function, for example stores some important data in a thread local variable, but flags (thread global) the availability of the data, then no Critical section will fix it.

Admittedly this is a constructed case, and sounds like an extremely poor implementation... But it shows that thread-safety is more than just a Critical Section. After execution of a thread-save function the overall state of your app (and the entire system) must still be valid (and it must be so, for each thread).

Martin


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to