Add cache lock deadlock problem to roadmap for 0.5.2.

Disable mutex locks, (making the caches non-thread-safe again, just like they were in the last snapshot and before).
This commit is contained in:
Carl Worth 2005-07-11 16:07:08 +00:00
parent e9d42ab9f9
commit abdaf7555f
3 changed files with 53 additions and 12 deletions

View file

@ -1,3 +1,11 @@
2005-07-11 Carl Worth <cworth@cworth.org>
* 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).
2005-07-11 Carl Worth <cworth@cworth.org>
* ROADMAP: Note that the cairo_content_t work is done.

View file

@ -13,6 +13,15 @@ cairo 0.5.2
Use XCopyArea when possible (integer translation)
Otherwise make a copy of the source
Fix the cache lock deadlocking problems.
Difficulty: Hard
Status: The cache code was ugly enough that I ended up doing a
major rewrite rather than just reviewing the
locking. The upside is that the rewrite should also
add the missing metrics caches which will fix some
performance problems with text measurement. Almost
done now.
cairo 1.0 release requirements
==============================

View file

@ -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))