Use encoding names which may work better on Solaris. (#340434, Alessandro
[platform/upstream/glib.git] / gthread / gthread-solaris.c
index d303104..4f21798 100644 (file)
@@ -31,6 +31,8 @@
  * MT safe
  */
 
+#include <config.h>
+
 #include <thread.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -54,16 +56,17 @@ static gulong g_thread_min_stack_size = 0;
 #define G_MUTEX_SIZE (sizeof (mutex_t))
 
 #define PRIORITY_LOW_VALUE 0
+#define PRIORITY_NORMAL_VALUE 50
 #define PRIORITY_URGENT_VALUE 127
 
-#ifdef _SC_THREAD_STACK_MIN
 #define HAVE_G_THREAD_IMPL_INIT
 static void 
 g_thread_impl_init()
 {
-  g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
+  g_thread_min_stack_size = thr_min_stack();
+  /* The default priority on Solaris is 0. Set it to something sane */
+  solaris_check_for_error (thr_setprio (thr_self (), PRIORITY_NORMAL_VALUE));
 }
-#endif /* _SC_THREAD_STACK_MIN */
 
 static GMutex *
 g_mutex_new_solaris_impl (void)
@@ -207,7 +210,8 @@ g_thread_create_solaris_impl (GThreadFunc thread_func,
   g_return_if_fail (priority >= G_THREAD_PRIORITY_LOW);
   g_return_if_fail (priority <= G_THREAD_PRIORITY_URGENT);
   
-  stack_size = MAX (g_thread_min_stack_size, stack_size);
+  if (stack_size)
+    stack_size = MAX (g_thread_min_stack_size, stack_size);
   
   ret = thr_create (NULL, stack_size, (void* (*)(void*))thread_func,
                    arg, flags, thread);