mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-21 13:20:59 +01:00
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.
Setup an automake conditional for the HAVE_PTHREAD case. Link all tests with -lpthread if available, so that we can get some testing of cairo with mutexes turned on.
This commit is contained in:
parent
615a32107d
commit
620de68bea
4 changed files with 31 additions and 37 deletions
16
ChangeLog
16
ChangeLog
|
|
@ -1,3 +1,19 @@
|
|||
2005-08-13 Carl Worth <cworth@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.
|
||||
|
||||
2005-08-13 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairoint.h:
|
||||
|
||||
2005-08-13 Carl Worth <cworth@cworth.org>
|
||||
|
||||
Minor, cosmetic changes:
|
||||
|
|
|
|||
|
|
@ -330,11 +330,8 @@ AC_SUBST(FT_FONT_FEATURE)
|
|||
|
||||
dnl ===========================================================================
|
||||
|
||||
#
|
||||
# The FreeType backend uses pthread locking when avaialble
|
||||
#
|
||||
|
||||
AC_CHECK_HEADERS([pthread.h])
|
||||
AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
|
||||
AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
|
||||
|
||||
dnl ===========================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -155,6 +155,10 @@ xmalloc.h
|
|||
|
||||
LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
|
||||
|
||||
if HAVE_PTHREAD
|
||||
LDADDS += -lpthread
|
||||
endif
|
||||
|
||||
# ARGH! I have to repeat the list of tests a third time. Maybe it's
|
||||
# time to break down and auto-generate the Makefile.am or something
|
||||
# from autogen.sh. My, but this is painful...
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue