7155300: Include pthread.h on all POSIX platforms except Solaris to improve portability
Reviewed-by: alanb, dholmes
This commit is contained in:
parent
b33626e87a
commit
550028f6a1
@ -37,10 +37,10 @@
|
|||||||
#include "manifest_info.h"
|
#include "manifest_info.h"
|
||||||
#include "version_comp.h"
|
#include "version_comp.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __solaris__
|
||||||
#include <pthread.h>
|
|
||||||
#else
|
|
||||||
#include <thread.h>
|
#include <thread.h>
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define JVM_DLL "libjvm.so"
|
#define JVM_DLL "libjvm.so"
|
||||||
@ -1434,7 +1434,18 @@ jlong_format_specifier() {
|
|||||||
int
|
int
|
||||||
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
||||||
int rslt;
|
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_t tid;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
@ -1459,17 +1470,6 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_attr_destroy(&attr);
|
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
|
#endif
|
||||||
return rslt;
|
return rslt;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
#include <thread.h>
|
#include <thread.h>
|
||||||
#endif
|
#else
|
||||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#endif
|
#endif
|
||||||
@ -306,9 +305,7 @@ dbgsysTlsGet(int index) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
|
||||||
int
|
int
|
||||||
dbgsysTlsAlloc() {
|
dbgsysTlsAlloc() {
|
||||||
pthread_key_t key;
|
pthread_key_t key;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user