Mail Archives: djgpp/1998/02/15/06:39:30
On Sat, 14 Feb 1998, Peter Palotas wrote:
> So if anyone could give me a good answer to this, I would be really
> greatful, because my program really *needs* a global linked list, and I
> want to know if I can somehow make sure it is thread safe on any
> multi-threading platform.
Every threading system has some way of serializing access to global
resources. So you can safely assume that some solution exists.
However, I wouldn't advise to assume that you *must* disable threading
to achieve this. For example, some system could let you ``lock'' a
variable in a way that disables access to it from all threads but the
one which locked it.
Therefore, it might be more portable to provide generic functions that
should be used to make a given variable inaccessible from the rest of
the threads, and another to remove this ``lock''. Any given
multi-threading package will have to supply its own version for these
two functions, and disabling all threading might be one possibility.
- Raw text -