[cairo-commit] cairo/src cairoint.h,1.194,1.195
Carl Worth
commit at pdx.freedesktop.org
Sat Aug 13 03:26:20 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv15701/src
Modified Files:
cairoint.h
Log Message:
2005-08-13 Carl Worth <cworth at cworth.org>
* src/cairoint.h: Turn the mutex code back on. It looks like the
deadlocks have disappeared as of the cairo_scaled_font_map patch
from two days ago.
* configure.in: Setup an automake conditional for the HAVE_PTHREAD
case.
* test/Makefile.am: Link all tests with -lpthread if available, so
that we can get some testing of cairo with mutexes turned on.
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- cairoint.h 13 Aug 2005 08:38:55 -0000 1.194
+++ cairoint.h 13 Aug 2005 10:26:18 -0000 1.195
@@ -117,43 +117,20 @@
#define __attribute__(x)
#endif
-/* XXX: There's a bad bug in the cache locking code that attempts to
- * recursively lock a mutex, (which we shouldn't actually need to ever
- * do). This leads to deadlocks in even single-threaded applications,
- * (if they link with -lpthread).
- *
- * For now, we're removing all mutex locking, which leaves things at
- * the same level of non-thread-safeness that we've had in every
- * snapshot since the cache code first landed.
- *
- * I'm rewriting the cache code now and plan to have thread-safe,
- * locking caches working before the next snapshot. CDW.
- */
-
-#if CAIRO_CACHE_CODE_IS_FIXED_TO_NOT_DEADLOCK_SINGLE_THREADED_APPLICATIONS
-
-# if HAVE_PTHREAD_H
-# define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
-# define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
-# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name)
-# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name)
-# endif
-
-# ifndef CAIRO_MUTEX_DECLARE
-# warning "No mutex declarations, assuming single-threaded code"
-# define CAIRO_MUTEX_DECLARE(name)
-# define CAIRO_MUTEX_DECLARE_GLOBAL(name)
-# define CAIRO_MUTEX_LOCK(name)
-# define CAIRO_MUTEX_UNLOCK(name)
-# endif
-
-#else
+#if HAVE_PTHREAD_H
+# include <pthread.h>
+# define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
+#define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
+# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name)
+# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name)
+#endif
+#ifndef CAIRO_MUTEX_DECLARE
+# warning "No mutex declarations, assuming single-threaded code"
# define CAIRO_MUTEX_DECLARE(name)
# define CAIRO_MUTEX_DECLARE_GLOBAL(name)
# define CAIRO_MUTEX_LOCK(name)
# define CAIRO_MUTEX_UNLOCK(name)
-
#endif
#define MIN(a, b) ((a) < (b) ? (a) : (b))
More information about the cairo-commit
mailing list