I'm too lazy to comment this

Original commit message from CVS:
combined patch by me and lioux@FreeBSD.org
This commit is contained in:
Thomas Vander Stichele 2002-07-11 21:22:55 +00:00
parent f1c9061f2a
commit 92de697c34
2 changed files with 20 additions and 3 deletions

View file

@ -320,6 +320,11 @@ if test "x$USE_ATOMIC_H" = xyes; then
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

View file

@ -178,7 +178,7 @@ gst_thread_init (GstThread *thread)
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;
}
@ -329,11 +329,23 @@ gst_thread_change_state (GstElement * element)
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);
}