AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
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]))
+
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])
fi
thread->cond = g_cond_new ();
thread->ppid = getpid ();
- thread->thread_id = -1;
+ thread->thread_id = (pthread_t) -1;
thread->sched_policy = SCHED_OTHER;
thread->priority = 0;
}
if (pthread_attr_init (&thread->attr) != 0)
g_warning ("pthread_attr_init returned an error !");
- if (gst_scheduler_get_preferred_stack (GST_ELEMENT_SCHED (element), &thread->stack, &stacksize)) {
+ if (gst_scheduler_get_preferred_stack (GST_ELEMENT_SCHED (element),
+ &thread->stack, &stacksize)) {
+#ifdef HAVE_PTHREAD_ATTR_SETSTACK
if (pthread_attr_setstack (&thread->attr, thread->stack, stacksize) != 0) {
- g_warning ("pthread_attr_setstack failed");
+ g_warning ("pthread_attr_setstack failed\n");
return GST_STATE_FAILURE;
}
+#else
+ if (pthread_attr_setstackaddr (&thread->attr, thread->stack) != 0) {
+ g_warning ("pthread_attr_setstackaddr failed\n");
+ return GST_STATE_FAILURE;
+ }
+ if (pthread_attr_setstacksize (&thread->attr, stacksize) != 0) {
+ g_warning ("pthread_attr_setstacksize failed\n");
+ return GST_STATE_FAILURE;
+ }
+#endif
GST_DEBUG (GST_CAT_THREAD, "pthread attr set stack at %p of size %ld",
thread->stack, stacksize);
}