Date: Sun, 15 Feb 1998 13:38:23 +0200 (IST) From: Eli Zaretskii To: Peter Palotas cc: djgpp AT delorie DOT com Subject: Re: Thread safe programs. In-Reply-To: <3.0.16.19980214230158.5057866a@hem1.passagen.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.