969 |
969 |
970 // Start in suspended state, and in os::thread_start, wake the thread up. |
970 // Start in suspended state, and in os::thread_start, wake the thread up. |
971 guarantee(pthread_attr_setsuspendstate_np(&attr, PTHREAD_CREATE_SUSPENDED_NP) == 0, "???"); |
971 guarantee(pthread_attr_setsuspendstate_np(&attr, PTHREAD_CREATE_SUSPENDED_NP) == 0, "???"); |
972 |
972 |
973 // calculate stack size if it's not specified by caller |
973 // calculate stack size if it's not specified by caller |
974 if (os::Aix::supports_variable_stack_size()) { |
974 if (stack_size == 0) { |
975 if (stack_size == 0) { |
975 stack_size = os::Aix::default_stack_size(thr_type); |
976 stack_size = os::Aix::default_stack_size(thr_type); |
976 |
977 |
977 switch (thr_type) { |
978 switch (thr_type) { |
978 case os::java_thread: |
979 case os::java_thread: |
979 // Java threads use ThreadStackSize whose default value can be changed with the flag -Xss. |
980 // Java threads use ThreadStackSize whose default value can be changed with the flag -Xss. |
980 assert(JavaThread::stack_size_at_create() > 0, "this should be set"); |
981 assert(JavaThread::stack_size_at_create() > 0, "this should be set"); |
981 stack_size = JavaThread::stack_size_at_create(); |
982 stack_size = JavaThread::stack_size_at_create(); |
982 break; |
|
983 case os::compiler_thread: |
|
984 if (CompilerThreadStackSize > 0) { |
|
985 stack_size = (size_t)(CompilerThreadStackSize * K); |
983 break; |
986 break; |
984 case os::compiler_thread: |
987 } // else fall through: |
985 if (CompilerThreadStackSize > 0) { |
988 // use VMThreadStackSize if CompilerThreadStackSize is not defined |
986 stack_size = (size_t)(CompilerThreadStackSize * K); |
989 case os::vm_thread: |
987 break; |
990 case os::pgc_thread: |
988 } // else fall through: |
991 case os::cgc_thread: |
989 // use VMThreadStackSize if CompilerThreadStackSize is not defined |
992 case os::watcher_thread: |
990 case os::vm_thread: |
993 if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); |
991 case os::pgc_thread: |
994 break; |
992 case os::cgc_thread: |
995 } |
993 case os::watcher_thread: |
996 } |
994 if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); |
997 |
995 break; |
998 stack_size = MAX2(stack_size, os::Aix::min_stack_allowed); |
996 } |
999 pthread_attr_setstacksize(&attr, stack_size); |
997 } |
|
998 |
|
999 stack_size = MAX2(stack_size, os::Aix::min_stack_allowed); |
|
1000 pthread_attr_setstacksize(&attr, stack_size); |
|
1001 } //else let thread_create() pick the default value (96 K on AIX) |
|
1002 |
1000 |
1003 pthread_t tid; |
1001 pthread_t tid; |
1004 int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); |
1002 int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); |
1005 |
1003 |
1006 pthread_attr_destroy(&attr); |
1004 pthread_attr_destroy(&attr); |