From a64e400a974e5b1bf72bf74c8f81191c8c8df055 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Thu, 11 Jul 2002 21:38:23 +0000 Subject: [PATCH] lioux's virtual patch Original commit message from CVS: lioux's virtual patch --- configure.ac | 7 ++++++- gst/cothreads.c | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 34f9a0f..a3bd2f9 100644 --- a/configure.ac +++ b/configure.ac @@ -323,7 +323,12 @@ fi dnl test if we have pthread_attr_setstack; if not use the older calls AC_CHECK_LIB(pthread, pthread_attr_setstack, AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACK, 1, - [Defined if libpthread has pthread_attr_setstack])) + [Defined if libpthread has pthread_attr_setstack ()])) + +dnl test if we have posix_memalign; FreeBSD doesn't +AC_CHECK_FUNC(posix_memalign, + AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, + [Defined if we have posix_memalign ()])) if test "x$PLUGINS_USE_BUILDDIR" = xyes; then AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this]) diff --git a/gst/cothreads.c b/gst/cothreads.c index 7b01b15..a4d7257 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -499,6 +499,7 @@ cothread_stackquery (void **stack, glong* stacksize) int retval = 0; +#ifdef HAVE_POSIX_MEMALIGN retval = posix_memalign (stack, STACK_SIZE, STACK_SIZE); if (retval != 0) { @@ -514,6 +515,16 @@ cothread_stackquery (void **stack, glong* stacksize) } GST_DEBUG (GST_CAT_THREAD, "have posix_memalign at %p of size %d", (void *) *stack, STACK_SIZE); +#else + if ((*stack = valloc (STACK_SIZE)) != 0) + { + g_warning ("Could not valloc stack !\n"); + return FALSE; + } + GST_DEBUG (GST_CAT_THREAD, "have valloc at %p of size %d", + (void *) *stack, STACK_SIZE); +#endif + GST_DEBUG (GST_CAT_COTHREADS, "Got new cothread stack from %p to %p (size %ld)", *stack, *stack + STACK_SIZE - 1, (long) STACK_SIZE); -- 2.7.4