<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 27/06/2011 11:19, Michael Schnell wrote:
<blockquote cite="mid:4E085940.50001@lumino.de" type="cite">On
06/27/2011 11:37 AM, Martin wrote: <br>
<blockquote type="cite"> <br>
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.
<br>
<br>
</blockquote>
Yep ! <br>
<br>
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. <br>
</blockquote>
<br>
Why? Where does the definition conflict with the above?<br>
"A piece of code is <b>thread-safe</b> if it can be safely
invoked by multiple threads at the same time"<br>
<br>
"Save invocation" includes that the function returns a "correct"
result(output) for any "input".<br>
<br>
Where "input":<br>
- is not limited to the parameters passed in the parameter list, not
even to limited to parameters passed implicitly (such as the object
instance)<br>
- input includes the entire state of the system (that can be global
vars, available and unavailable resources of any kind, and much
more)<br>
The same applies to "result", or "output".<br>
<br>
This part of "Save invocation" is not limited to thread safeness. It
applies to any piece of code. <br>
For example, a piece of code involving memory allocation, must
examine the result of the actual "AllocMem" call for errors.
Otherwhise it is not save to be executed, as it may fail with an
undefined result, if no mem is available.<br>
<br>
So as far as I can see, my example, (as well as objects) are very
well covered by the definition.<br>
<br>
Martin<br>
<br>
<br>
</body>
</html>