8301570: Test runtime/jni/nativeStack/ needs to detach the native thread

Co-authored-by: Calvin Cheung <ccheung@openjdk.org>
Reviewed-by: lmesnik, ccheung
This commit is contained in:
David Holmes 2023-02-01 07:56:21 +00:00
parent 8164cfbc03
commit d269ebbad2

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -85,6 +85,13 @@ static void * thread_start(void* unused) {
(*env)->ExceptionDescribe(env);
exit(1);
}
res = (*jvm)->DetachCurrentThread(jvm);
if (res != JNI_OK) {
fprintf(stderr, "Test ERROR. Can't detach current thread: %d\n", res);
exit(1);
}
printf("Native thread terminating\n");
return NULL;