- 引数で渡されたJavaスレッドをOSスレッドに結びつける
Bool os::create_attached_thread(JavaThread* thread) {
#Ifdef ASSERT
thread->verify_not_published();
#endif
OSThread* osthread = new OSThread(NULL, NULL);
if (osthread == NULL) {
return false;
}
osthread->set_thread_id(os::Linux::gettid());
osthread->set_pthread_id(::pthread_self());
os::Linux::init_thread_fpu_state();
osthread->set_state(RUNNABLE);
thread->set_osthread(osthread);
if (UseNUMA) {
int lgrp_id = os::numa_get_group_id();
if (lgrp_id != -1) {
thread->set_lgrp_id(lgrp_id);
}
}
if (os::Linux::is_initial_thread()) {
JavaThread *jt = (JavaThread *)thread;
address addr = jt->stack_yellow_zone_base();
assert(addr != NULL, "initialization problem?");
assert(jt->stack_available(addr) > 0, "stack guard should not be enabled");
osthread->set_expanding_stack();
os::Linux::manually_expand_stack(jt, addr);
osthread->clear_expanding_stack();
}
os::Linux::hotspot_sigmask(thread);
return true;
}