Re: fontconfig: Branch 'master' - 23 commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Behdad Esfahbod wrote:
[...]

diff --git a/configure.ac b/configure.ac
index 5657bb5..fda5650 100644
--- a/configure.ac
+++ b/configure.ac

[...]

+
+have_pthread=false
+if test "$os_win32" = no; then
+	AX_PTHREAD([have_pthread=true])
+fi
+if $have_pthread; then
+	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
+fi
+AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)

I was doing some more testing and got coredumps when using FcFontMatch from multiple threads on Solaris, using GCC as well as Sun Studio (the latter with atomic operations from atomic.h, see attached -- /experimental/ -- patch -- which is NO suggestion for the upcoming snapshot release (*) ).

Then I noticed that -mt or -D_REENTRANT had not been passed to 'cc'. Now this is a Solaris specialty but I think AX_PTHREAD could do all the work:

http://www.gnu.org/software/autoconf-archive/ax_pthread.html

For now I seem to be successful by adding the following in the 'if $have_pthread' branch above, as suggested by the linked docs:

       LIBS="$PTHREAD_LIBS $LIBS"
       CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
       CC="$PTHREAD_CC"


(*) Solaris atomic operations do not implement a full memory barrier. However, I'm not sure whether this is a problem for the way fontconfig uses these operations. So far I've not been able to attribute any coredumps to _this_ circumstance. This would need attention from an expert on the subject (which I'm not).


Raimund



--
Worringer Str 31 Duesseldorf 40211 DE  home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346           work: <rs@xxxxxxxxxxxxxxx>
diff --git a/configure.ac b/configure.ac
index 4beca08..db745ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -590,8 +590,21 @@ if $fc_cv_have_intel_atomic_primitives; then
 	AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
 fi
 
+AC_CACHE_CHECK([for Solaris atomic operations], fc_cv_have_solaris_atomic_ops, [
+	fc_cv_have_solaris_atomic_ops=false
+	AC_TRY_LINK([
+		#include <atomic.h>
+		int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
+		void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
+		], [], fc_cv_have_solaris_atomic_ops=true
+	)
+])
+if $fc_cv_have_solaris_atomic_ops; then
+	AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris atomic_* operations])
+fi
+
 AC_CHECK_HEADERS(sched.h)
-AC_CHECK_FUNCS(sched_yield)
+AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
 
 have_pthread=false
 if test "$os_win32" = no; then
@@ -599,6 +612,9 @@ if test "$os_win32" = no; then
 fi
 if $have_pthread; then
 	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
+	LIBS="$PTHREAD_LIBS $LIBS"
+	CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+	CC="$PTHREAD_CC"
 fi
 AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
 
diff --git a/src/fcatomic.h b/src/fcatomic.h
index 72ae372..a07a958 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -86,6 +86,15 @@ typedef int fc_atomic_int_t;
 #define fc_atomic_ptr_get(P)		(void *) (__sync_synchronize (), *(P))
 #define fc_atomic_ptr_cmpexch(P,O,N)	__sync_bool_compare_and_swap ((P), (O), (N))
 
+#elif !defined(FC_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS)
+
+#include <atomic.h>
+
+typedef unsigned int fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V)	(atomic_add_int_nv (&(AI), (V)) - (V))
+
+#define fc_atomic_ptr_get(P)		((void *) *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N)	(atomic_cas_ptr ((P), (O), (N)) == (void *) (O) ? FcTrue : FcFalse)
 
 #elif !defined(FC_NO_MT)
 
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux