On 06/10/2011 03:32 PM, Mattias Gaertner wrote:
If the definition says "it can be safely invoked by multiple threads at
the same time" then it means it can be invoked by any thread in any order at
any time and the code still performs its task.
But what is "it".
The wiki says: "piece of code". With Objects this would need to be
"piece of code of a particular instance", as the same "piece of code" of
another instance c an behave totally different, as the states that are
stored in the instance can behave totally different.
Of course (only with less practical value) this is also true in a
not-object languages:
The "piece of code" can be a function that is called with a parameter.
It can be thread safe if each thread calls it with a different parameter
value (say a number denoting the thread) and not thread safe if some
threads call it with the same parameter.
e.g.:
void a(n) {
array[n] ++;
}
-Michael
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus