mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8215009: GCC 8 compilation error in libjli
Reviewed-by: dholmes, mikael, rriggs
This commit is contained in:
parent
7af48cfb45
commit
b818234d2a
5 changed files with 86 additions and 63 deletions
|
@ -718,10 +718,17 @@ void SplashFreeLibrary() {
|
|||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread
|
||||
* Signature adapter for pthread_create() or thr_create().
|
||||
*/
|
||||
static void* ThreadJavaMain(void* args) {
|
||||
return (void*)(intptr_t)JavaMain(args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Block current thread and continue execution in a new thread.
|
||||
*/
|
||||
int
|
||||
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
||||
CallJavaMainInNewThread(jlong stack_size, void* args) {
|
||||
int rslt;
|
||||
#ifndef __solaris__
|
||||
pthread_t tid;
|
||||
|
@ -730,35 +737,35 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
|
|||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
if (stack_size > 0) {
|
||||
pthread_attr_setstacksize(&attr, stack_size);
|
||||
pthread_attr_setstacksize(&attr, stack_size);
|
||||
}
|
||||
pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
|
||||
|
||||
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
|
||||
void * tmp;
|
||||
pthread_join(tid, &tmp);
|
||||
rslt = (int)(intptr_t)tmp;
|
||||
if (pthread_create(&tid, &attr, ThreadJavaMain, args) == 0) {
|
||||
void* tmp;
|
||||
pthread_join(tid, &tmp);
|
||||
rslt = (int)(intptr_t)tmp;
|
||||
} else {
|
||||
/*
|
||||
* Continue execution in current thread if for some reason (e.g. out of
|
||||
* memory/LWP) a new thread can't be created. This will likely fail
|
||||
* later in continuation as JNI_CreateJavaVM needs to create quite a
|
||||
* few new threads, anyway, just give it a try..
|
||||
*/
|
||||
rslt = continuation(args);
|
||||
/*
|
||||
* Continue execution in current thread if for some reason (e.g. out of
|
||||
* memory/LWP) a new thread can't be created. This will likely fail
|
||||
* later in JavaMain as JNI_CreateJavaVM needs to create quite a
|
||||
* few new threads, anyway, just give it a try..
|
||||
*/
|
||||
rslt = JavaMain(args);
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
#else /* __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)(intptr_t)tmp;
|
||||
if (thr_create(NULL, stack_size, ThreadJavaMain, args, flags, &tid) == 0) {
|
||||
void* tmp;
|
||||
thr_join(tid, NULL, &tmp);
|
||||
rslt = (int)(intptr_t)tmp;
|
||||
} else {
|
||||
/* See above. Continue in current thread if thr_create() failed */
|
||||
rslt = continuation(args);
|
||||
/* See above. Continue in current thread if thr_create() failed */
|
||||
rslt = JavaMain(args);
|
||||
}
|
||||
#endif /* !__solaris__ */
|
||||
return rslt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue