>Randy Howard wrote:
In addition to the other reply, see comp.programming.threads
[which is of course good advice.]
In article <43***************@yahoo.com>
CBFalconer <cb********@worldnet.att.net> wrote:I think we can safely say that a function that calls only safe
functions, and uses only local storage and value parameters (not
pointers) is proof against most things.
Except, perhaps, compilers and/or hardware that use
inherently-thread-unsafe code. (These do exist.) Presumably
a system that offers thread support at all will run on hardware
that is not inherently unsafe, and will offer compiler options
(perhaps the default, even) that are thread-safe in at least
most circumstances.
(An example of hardware that is inherently "thread unsafe" is
the old mainframe machine -- I forget which one -- in which the
function-call instruction wrote the return address at the
first word of the target:
CALL foo
...
foo: .word 0 # reserved for return address
... machine code for function foo()
(begins by saving the return address on a stack
so that foo() can be called recursively; note that
the hardware does not offer direct support for stacks,
either, so we probably use a linked list obtained by
the underlying equivalent of malloc().)
Fortunately for most programmers, such hardware long ago went
out of style, and -- at least so far -- has not come back.)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.