galib and threadsafeness

Matthew Wall mbwall_NO_SPAM at mit.edu
Wed Sep 23 11:23:17 EDT 1998


Here are all the statically-defined variables that could be a problem for
multi-threading.  I don't think any of these would cause a crash, but i have
not done enough multithreaded work (none with galib - yet :) to know.

There are no class-specific static data members, but there are many static
member functions.

The statics below were defined as statics in order to make the functions
in which they live more efficient.  In most cases multi-threading should only
result in race conditions and perhaps bogus data, but probably not crashes 
(unless bogus data from the random functions ends up becoming bad array 
indices in a population or genome)


GA1DBinStrGenome.C:  static char c;
GA2DBinStrGenome.C:  static char c;
GA3DBinStrGenome.C:  static char c;
gaerror.C:static ostream *__gaErrStream = &cerr;
gaerror.C:static GABoolean __gaErrFlag = gaTrue;
garandom.C:  static unsigned int seed=0;
garandom.C:  static GABoolean cached=gaFalse;
garandom.C:  static double cachevalue;
garandom.C:static unsigned long iseed;
garandom.C:static long iy=0;
garandom.C:static long iv[NTAB];
garandom.C:static long idum=0;
garandom.C:static long idum2=123456789;
garandom.C:static long iy=0;
garandom.C:static long iv[NTAB];
garandom.C:static long idum=0;
garandom.C:static int inext,inextp;
garandom.C:static long ma[56];


If you have any details about how your program is crashing (perhaps a stack 
trace) that could help me figure out where galib is not thread-safe, I would 
greatly appreciate it.


thanks

matthew





More information about the galib mailing list