diff -ur glib-2.6.5/gthread/gthread-posix.c glib-2.6.5-fbsd/gthread/gthread-posix.c --- glib-2.6.5/gthread/gthread-posix.c 2005-06-09 17:27:13.000000000 +0200 +++ glib-2.6.5-fbsd/gthread/gthread-posix.c 2005-08-13 18:12:54.000000000 +0200 @@ -115,7 +115,11 @@ # define PRIORITY_NORMAL_VALUE priority_normal_value #endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ +#define G_THREAD_STACK_SIZE32 (1*1024*1024) +#define G_THREAD_STACK_SIZE64 (2*1024*1024) + static gulong g_thread_min_stack_size = 0; +static gulong g_thread_default_stack_size = 0; #define G_MUTEX_SIZE (sizeof (pthread_mutex_t)) @@ -125,7 +129,8 @@ g_thread_impl_init(void) { #ifdef _SC_THREAD_STACK_MIN - g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0); + g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), + g_thread_min_stack_size); #endif /* _SC_THREAD_STACK_MIN */ #ifdef HAVE_PRIORITIES # ifdef G_THREADS_IMPL_POSIX @@ -176,7 +181,7 @@ result = pthread_mutex_trylock ((pthread_mutex_t *) mutex); #ifdef G_THREADS_IMPL_POSIX - if (result == EBUSY) + if ((result == EBUSY) || (result == EDEADLK)) return FALSE; #else /* G_THREADS_IMPL_DCE */ if (result == 0) @@ -309,8 +314,16 @@ stack_size = MAX (g_thread_min_stack_size, stack_size); /* No error check here, because some systems can't do it and * we simply don't want threads to fail because of that. */ - pthread_attr_setstacksize (&attr, stack_size); } + else + { + if (sizeof(void *) == 8) + g_thread_default_stack_size = G_THREAD_STACK_SIZE64; + else + g_thread_default_stack_size = G_THREAD_STACK_SIZE32; + stack_size = MAX (g_thread_min_stack_size, g_thread_default_stack_size); + } + pthread_attr_setstacksize (&attr, stack_size); #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */ #ifdef PTHREAD_SCOPE_SYSTEM Only in glib-2.6.5-fbsd/gthread: gthread-posix.c.orig