[Lazarus] thread safe

Martin lazarus at mfriebe.de
Mon Jun 27 13:00:27 CEST 2011


On 27/06/2011 11:58, Martin wrote:
> On 27/06/2011 11:19, Michael Schnell wrote:
>> On 06/27/2011 11:37 AM, Martin wrote:
>>>
>>> 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.
>>>
>> Yep !
>>
>> As stated in my former messages in this thread, IMHO, the "official" 
>> definition of thread-safe-ness does not make much sense with objects, 
>> but a more complex definition covering several cases of use is 
>> necessary.
>
> Why? Where does the definition conflict with the above?
>   "A piece of code is *thread-safe* if it can be safely invoked by 
> multiple threads at the same time"
>
> "Save invocation" includes that the function returns a "correct" 
> result(output) for any "input".
Make that "any defined/allowed" input

Obviously if you pass in a pointer to random memory as object instance 
no function will be ave to call.


>
> Where "input":
> - is not limited to the parameters passed in the parameter list, not 
> even to limited to parameters passed implicitly (such as the object 
> instance)
> - input includes the entire state of the system (that can be global 
> vars, available and unavailable resources of any kind, and much more)
> The same applies to "result", or "output".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110627/bf346813/attachment-0003.html>


More information about the Lazarus mailing list