lioux's virtual patch
authorThomas Vander Stichele <thomas@apestaart.org>
Thu, 11 Jul 2002 21:38:23 +0000 (21:38 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Thu, 11 Jul 2002 21:38:23 +0000 (21:38 +0000)
Original commit message from CVS:
lioux's virtual patch

configure.ac
gst/cothreads.c

index 34f9a0f..a3bd2f9 100644 (file)
@@ -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])
index 7b01b15..a4d7257 100644 (file)
@@ -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);