Skip to content

Commit 0eb12e6

Browse files
committed
Add debug output for when a new thread is created.
1 parent 0a88d79 commit 0eb12e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/src/org.graalvm.launcher.native/src/launcher.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,8 @@ int main(int argc, char *argv[]) {
707707
* [1] https://github.com/openjdk/jdk/blob/8c1b915c7ef2b3a6e65705b91f4eb464caaec4e7/src/java.base/unix/native/libjli/java_md.c#L114
708708
* [2] https://github.com/openjdk/jdk/blob/8c1b915c7ef2b3a6e65705b91f4eb464caaec4e7/src/java.base/macosx/native/libjli/java_md_macosx.m#L292-L325
709709
*/
710-
bool use_new_thread = stack_size > current_thread_stack_size();
710+
size_t main_thread_stack_size = current_thread_stack_size();
711+
bool use_new_thread = stack_size > main_thread_stack_size;
711712
#if defined (__APPLE__)
712713
/* On macOS, always create a dedicated "main" thread for the JVM.
713714
* The actual main thread must run the UI event loop (needed for AWT).
@@ -724,6 +725,9 @@ int main(int argc, char *argv[]) {
724725

725726
if (use_new_thread) {
726727
auto threadArgs = std::make_unique<decltype(parsedArgs)>(std::move(parsedArgs));
728+
if (debug) {
729+
std::cout << "Creating a new thread for the JVM with stack_size=" << stack_size << " main_thread_stack_size=" << main_thread_stack_size << std::endl;
730+
}
727731

728732
#ifndef _WIN32
729733
pthread_attr_t attr;

0 commit comments

Comments
 (0)