Index: [thread] [date] [subject] [author]
  From: MenTaLguY <mentalg@geocities.com>
  To  : ggi-develop@eskimo.com
  Date: Sun, 5 Jul 1998 18:46:56 -0400 (EDT)

Re: _ggi_malloc()

> This reminds me, we should have wrappers too for locks (X targets).  We
> would normally use ints for locking, but when we have pthreads we should use
> real mutexes, or spinlocks on Linux. 
> But then, it doesn't look like the targets are thread safe at all...

Just plain ints aren't async-signal-safe anyway, unless you wrap tests and
sets with sigprocmask or similar -- you need a guaranteed atomic
test-and-set operation, which you basically need spinlocks for
(LinuxThreads's synchronization object implementation uses spinlocks as
well, in addition to putting threads to sleep to prevent excessive
busy-waiting).

By the way, sigprocmask() is fairly expensive, even under Linux, last I
heard. :/

Additionally, even if it is not intended to use threads itself, libggi
SHOULD be compiled with -D_REENTRANT, no matter what. I don't think that's
done currently, except for the threads-enabled version (which, strangely
enough, doesn't really seem to use threads). Otherwise, you need to compile
a special version to use with multithreaded apps, even if they would only
keep one thread in the libggi stuff themselves anyway. 

Recompiling all your old libraries with -D_REENTRANT so you can write a
multithreaded program that can actually _do_ something is a royal pain.

-=MenTaLguY=-

Index: [thread] [date] [subject] [author]