Lines 115-121
Link Here
|
115 |
# define PRIORITY_NORMAL_VALUE priority_normal_value |
115 |
# define PRIORITY_NORMAL_VALUE priority_normal_value |
116 |
#endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ |
116 |
#endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ |
117 |
|
117 |
|
|
|
118 |
#define G_THREAD_STACK_SIZE32 (1*1024*1024) |
119 |
#define G_THREAD_STACK_SIZE64 (2*1024*1024) |
120 |
|
118 |
static gulong g_thread_min_stack_size = 0; |
121 |
static gulong g_thread_min_stack_size = 0; |
|
|
122 |
static gulong g_thread_default_stack_size = 0; |
119 |
|
123 |
|
120 |
#define G_MUTEX_SIZE (sizeof (pthread_mutex_t)) |
124 |
#define G_MUTEX_SIZE (sizeof (pthread_mutex_t)) |
121 |
|
125 |
|
Lines 125-131
Link Here
|
125 |
g_thread_impl_init(void) |
129 |
g_thread_impl_init(void) |
126 |
{ |
130 |
{ |
127 |
#ifdef _SC_THREAD_STACK_MIN |
131 |
#ifdef _SC_THREAD_STACK_MIN |
128 |
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0); |
132 |
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), |
|
|
133 |
g_thread_min_stack_size); |
129 |
#endif /* _SC_THREAD_STACK_MIN */ |
134 |
#endif /* _SC_THREAD_STACK_MIN */ |
130 |
#ifdef HAVE_PRIORITIES |
135 |
#ifdef HAVE_PRIORITIES |
131 |
# ifdef G_THREADS_IMPL_POSIX |
136 |
# ifdef G_THREADS_IMPL_POSIX |
Lines 176-182
Link Here
|
176 |
result = pthread_mutex_trylock ((pthread_mutex_t *) mutex); |
181 |
result = pthread_mutex_trylock ((pthread_mutex_t *) mutex); |
177 |
|
182 |
|
178 |
#ifdef G_THREADS_IMPL_POSIX |
183 |
#ifdef G_THREADS_IMPL_POSIX |
179 |
if (result == EBUSY) |
184 |
if ((result == EBUSY) || (result == EDEADLK)) |
180 |
return FALSE; |
185 |
return FALSE; |
181 |
#else /* G_THREADS_IMPL_DCE */ |
186 |
#else /* G_THREADS_IMPL_DCE */ |
182 |
if (result == 0) |
187 |
if (result == 0) |
Lines 309-316
Link Here
|
309 |
stack_size = MAX (g_thread_min_stack_size, stack_size); |
314 |
stack_size = MAX (g_thread_min_stack_size, stack_size); |
310 |
/* No error check here, because some systems can't do it and |
315 |
/* No error check here, because some systems can't do it and |
311 |
* we simply don't want threads to fail because of that. */ |
316 |
* we simply don't want threads to fail because of that. */ |
312 |
pthread_attr_setstacksize (&attr, stack_size); |
|
|
313 |
} |
317 |
} |
|
|
318 |
else |
319 |
{ |
320 |
if (sizeof(void *) == 8) |
321 |
g_thread_default_stack_size = G_THREAD_STACK_SIZE64; |
322 |
else |
323 |
g_thread_default_stack_size = G_THREAD_STACK_SIZE32; |
324 |
stack_size = MAX (g_thread_min_stack_size, g_thread_default_stack_size); |
325 |
} |
326 |
pthread_attr_setstacksize (&attr, stack_size); |
314 |
#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */ |
327 |
#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */ |
315 |
|
328 |
|
316 |
#ifdef PTHREAD_SCOPE_SYSTEM |
329 |
#ifdef PTHREAD_SCOPE_SYSTEM |