GNOME Bugzilla – Bug 90195
make it somewhat more portable
Last modified: 2005-01-25 20:04:33 UTC
As above, a noddy patch - in-line: +2002-08-08 Michael Meeks <michael@ximian.com> + + * memintercept.c: switch to gthread for Solaris. + Tue Aug 6 21:14:00 2002 Owen Taylor <otaylor@redhat.com> * memintercept.c (debug): Add a mini-printf implementation, use Index: memintercept.c =================================================================== RCS file: /cvs/gnome/memprof/memintercept.c,v retrieving revision 1.15 diff -u -p -u -r1.15 memintercept.c --- memintercept.c 8 Aug 2002 01:32:55 -0000 1.15 +++ memintercept.c 8 Aug 2002 10:41:57 -0000 @@ -33,7 +33,7 @@ #include <stdarg.h> #include "memintercept.h" -#include <pthread.h> +#include <glib/gthread.h> #include <sys/socket.h> #include <sys/types.h> @@ -59,7 +59,7 @@ static void (*old__exit) (int status); #define MAX_THREADS 128 -static pthread_mutex_t malloc_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static GStaticRecMutex malloc_mutex = G_STATIC_REC_MUTEX_INIT; static int tracing = 1; static int pids[MAX_THREADS]; @@ -74,8 +74,8 @@ int starter_last = 0; #undef ENABLE_DEBUG -#define MI_LOCK() pthread_mutex_lock (&malloc_mutex); -#define MI_UNLOCK() pthread_mutex_unlock (&malloc_mutex); +#define MI_LOCK() g_static_rec_mutex_lock (&malloc_mutex); +#define MI_UNLOCK() g_static_rec_mutex_unlock (&malloc_mutex); static void abort_unitialized (const char *call)
So it appears that it's a larger task than I expected, but nevertheless the attached patch makes it at least build and link on Linux and Solaris. Lots of interesting mixed pointer length stuff needs doing too I'd guess.
Created attachment 10360 [details] [review] portability patch
Reassigning to memprof-maint alias
No trace of pthreads in the current code. Closing.