# HG changeset patch # User zhangshj # Date 1332390643 -28800 # Node ID 1be435e235420951e02e8e842eece1324e43635c # Parent 2a63f5718d3394b27d3a9f000ccf2e42e1884dc8 7155300: Include pthread.h on all POSIX platforms except Solaris to improve portability Reviewed-by: alanb, dholmes diff -r 2a63f5718d33 -r 1be435e23542 jdk/src/solaris/bin/java_md.c --- a/jdk/src/solaris/bin/java_md.c Wed Mar 21 10:10:38 2012 -0700 +++ b/jdk/src/solaris/bin/java_md.c Thu Mar 22 12:30:43 2012 +0800 @@ -37,10 +37,10 @@ #include "manifest_info.h" #include "version_comp.h" -#ifdef __linux__ +#ifdef __solaris__ +#include +#else #include -#else -#include #endif #define JVM_DLL "libjvm.so" @@ -1434,7 +1434,18 @@ 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 below. Continue in current thread if thr_create() failed */ + rslt = continuation(args); + } +#else pthread_t tid; pthread_attr_t attr; pthread_attr_init(&attr); @@ -1459,17 +1470,6 @@ } 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; } diff -r 2a63f5718d33 -r 1be435e23542 jdk/src/solaris/transport/socket/socket_md.c --- a/jdk/src/solaris/transport/socket/socket_md.c Wed Mar 21 10:10:38 2012 -0700 +++ b/jdk/src/solaris/transport/socket/socket_md.c Thu Mar 22 12:30:43 2012 +0800 @@ -35,8 +35,7 @@ #include #ifdef __solaris__ #include -#endif -#if defined(__linux__) || defined(_ALLBSD_SOURCE) +#else #include #include #endif @@ -306,9 +305,7 @@ return r; } -#endif - -#if defined(__linux__) || defined(_ALLBSD_SOURCE) +#else int dbgsysTlsAlloc() { pthread_key_t key;