www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/15/06:39:30

Date: Sun, 15 Feb 1998 13:38:23 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
cc: djgpp AT delorie DOT com
Subject: Re: Thread safe programs.
In-Reply-To: <3.0.16.19980214230158.5057866a@hem1.passagen.se>
Message-ID: <Pine.SUN.3.91.980215133757.27889U-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019