mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 13:48:02 +02: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>
|
2005-08-13 Carl Worth <cworth@cworth.org>
|
||||||
|
|
||||||
Minor, cosmetic changes:
|
Minor, cosmetic changes:
|
||||||
|
|
|
||||||
|
|
@ -330,11 +330,8 @@ AC_SUBST(FT_FONT_FEATURE)
|
||||||
|
|
||||||
dnl ===========================================================================
|
dnl ===========================================================================
|
||||||
|
|
||||||
#
|
AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
|
||||||
# The FreeType backend uses pthread locking when avaialble
|
AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
|
||||||
#
|
|
||||||
|
|
||||||
AC_CHECK_HEADERS([pthread.h])
|
|
||||||
|
|
||||||
dnl ===========================================================================
|
dnl ===========================================================================
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,43 +117,20 @@
|
||||||
#define __attribute__(x)
|
#define __attribute__(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* XXX: There's a bad bug in the cache locking code that attempts to
|
#if HAVE_PTHREAD_H
|
||||||
* recursively lock a mutex, (which we shouldn't actually need to ever
|
# include <pthread.h>
|
||||||
* do). This leads to deadlocks in even single-threaded applications,
|
# define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
|
||||||
* (if they link with -lpthread).
|
#define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
|
||||||
*
|
# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name)
|
||||||
* For now, we're removing all mutex locking, which leaves things at
|
# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name)
|
||||||
* the same level of non-thread-safeness that we've had in every
|
#endif
|
||||||
* 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
|
|
||||||
|
|
||||||
|
#ifndef CAIRO_MUTEX_DECLARE
|
||||||
|
# warning "No mutex declarations, assuming single-threaded code"
|
||||||
# define CAIRO_MUTEX_DECLARE(name)
|
# define CAIRO_MUTEX_DECLARE(name)
|
||||||
# define CAIRO_MUTEX_DECLARE_GLOBAL(name)
|
# define CAIRO_MUTEX_DECLARE_GLOBAL(name)
|
||||||
# define CAIRO_MUTEX_LOCK(name)
|
# define CAIRO_MUTEX_LOCK(name)
|
||||||
# define CAIRO_MUTEX_UNLOCK(name)
|
# define CAIRO_MUTEX_UNLOCK(name)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,10 @@ xmalloc.h
|
||||||
|
|
||||||
LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
|
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
|
# 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
|
# time to break down and auto-generate the Makefile.am or something
|
||||||
# from autogen.sh. My, but this is painful...
|
# from autogen.sh. My, but this is painful...
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue