<!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 12:23, Michael Schnell wrote:
<blockquote cite="mid:4E086827.1090506@lumino.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
On 06/27/2011 12:51 PM, Martin wrote:
<blockquote cite="mid:4E0860CB.2070504@mfriebe.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<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>
</blockquote>
It does not <b>conflict</b> it is just not useful.<br>
<br>
The problem is not "safe invocation" the problem is "<b>a</b>
piece of code".<br>
<br>
An object is invocated with a hidden self pointer. So for the
"user" this "self" is not an "input" as normal parameters are. <br>
</blockquote>
<br>
Unfortunately you left out the real important part of my last msg.<br>
<br>
If you choose to ignore the full meaning of "safely invoked " (even
WITHOUT threads), then I agree the definition is not useful. But
then which definition is useful if you ignore parts of it?<br>
<br>
Ask yourself: WITHOUT threads, when can a piece of code be "safely
invoked"?<br>
Answer: It can be safely invoked, if it will return a correct result
for any input, within the range of input for which it is defined.<br>
<br>
See my example about memory alloc in my other mail. It shows, that a
piece of code (and it's ability to be "safely invoked ") does not
solely depend on the parameters passed, but also on (selected parts
of) the state of the application or system.<br>
<br>
<br>
<br>
<blockquote cite="mid:4E086827.1090506@lumino.de" type="cite"> <br>
By definition, an object is a combination of a data store and a
pool of functions. <br>
</blockquote>
The data part can be seen as "input", for the above definition<br>
That this input is made available in a specific way does not matter.<br>
<br>
But yes, It's your choice.<br>
<br>
You can have an indefinite amount of definitions for each possible
special case .<br>
Or you can have one definition, using the most abstract common part
of them all.<br>
<br>
For the above it is enough to see an object as "a piece of code" (or
several pieces of code), for (each of) which the data is a part of
the input. It does not matter by which means this input is made
available. It does not matter that the programmer does not need to
explicitly specify this input.<br>
</body>
</html>