src/solaris/bin/java_md.c

Print this page

        

@@ -35,14 +35,14 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include "manifest_info.h"
 #include "version_comp.h"
 
-#ifdef __linux__
-#include <pthread.h>
-#else
+#ifdef __solaris__
 #include <thread.h>
+#else
+#include <pthread.h>
 #endif
 
 #define JVM_DLL "libjvm.so"
 #define JAVA_DLL "libjava.so"
 

@@ -1432,11 +1432,22 @@
  * Block current thread and continue execution in a new thread
  */
 int
 ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
     int rslt;
-#ifdef __linux__
+#ifdef __solaris__
+    thread_t tid;
+    long flags = 0;
+    if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
+      void * tmp;
+      thr_join(tid, NULL, &tmp);
+      rslt = (int)tmp;
+    } else {
+      /* See above. Continue in current thread if thr_create() failed */
+      rslt = continuation(args);
+    }
+#else
     pthread_t tid;
     pthread_attr_t attr;
     pthread_attr_init(&attr);
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 

@@ -1457,21 +1468,10 @@
       */
       rslt = continuation(args);
     }
 
     pthread_attr_destroy(&attr);
-#else
-    thread_t tid;
-    long flags = 0;
-    if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
-      void * tmp;
-      thr_join(tid, NULL, &tmp);
-      rslt = (int)tmp;
-    } else {
-      /* See above. Continue in current thread if thr_create() failed */
-      rslt = continuation(args);
-    }
 #endif
     return rslt;
 }
 
 /* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */