[cairo-commit] cairo/src cairoint.h,1.161,1.162

Carl Worth commit at pdx.freedesktop.org
Mon Jul 11 16:07:11 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv32555/src

Modified Files:
	cairoint.h 
Log Message:

        * ROADMAP: Add cache lock deadlock problem to roadmap for 0.5.2.

        * src/cairoint.h: Disable mutex locks, (making the caches
        non-thread-safe again, just like they were in the last snapshot
        and before).


Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- cairoint.h	8 Jul 2005 17:12:29 -0000	1.161
+++ cairoint.h	11 Jul 2005 23:07:09 -0000	1.162
@@ -120,19 +120,43 @@
 #define __attribute__(x)
 #endif
 
-#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
+/* 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
+
+# define CAIRO_MUTEX_DECLARE(name)
+# define CAIRO_MUTEX_DECLARE_GLOBAL(name)
+# define CAIRO_MUTEX_LOCK(name)
+# define CAIRO_MUTEX_UNLOCK(name)
 
-#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