526 #ifdef ASSERT
527 thread->verify_not_published();
528 #endif
529 if (_starting_thread == NULL) {
530 _starting_thread = create_os_thread(thread, main_thread, main_thread_id);
531 if (_starting_thread == NULL) {
532 return false;
533 }
534 }
535
536 // The primordial thread is runnable from the start)
537 _starting_thread->set_state(RUNNABLE);
538
539 thread->set_osthread(_starting_thread);
540 return true;
541 }
542
543 // Helper function to trace _beginthreadex attributes,
544 // similar to os::Posix::describe_pthread_attr()
545 static char* describe_beginthreadex_attributes(char* buf, size_t buflen,
546 size_t stacksize, unsigned initflag)
547 {
548 stringStream ss(buf, buflen);
549 if (stacksize == 0) {
550 ss.print("stacksize: default, ");
551 } else {
552 ss.print("stacksize: " SIZE_FORMAT "k, ", stacksize / 1024);
553 }
554 ss.print("flags: ");
555 #define PRINT_FLAG(f) if (initflag & f) ss.print( XSTR(f) " ");
556 #define ALL(X) \
557 X(CREATE_SUSPENDED) \
558 X(STACK_SIZE_PARAM_IS_A_RESERVATION)
559 ALL(PRINT_FLAG)
560 #undef ALL
561 #undef PRINT_FLAG
562 return buf;
563 }
564
565 // Allocate and initialize a new OSThread
566 bool os::create_thread(Thread* thread, ThreadType thr_type,
567 size_t stack_size) {
568 unsigned thread_id;
569
570 // Allocate the OSThread object
571 OSThread* osthread = new OSThread(NULL, NULL);
572 if (osthread == NULL) {
573 return false;
574 }
575
|
526 #ifdef ASSERT
527 thread->verify_not_published();
528 #endif
529 if (_starting_thread == NULL) {
530 _starting_thread = create_os_thread(thread, main_thread, main_thread_id);
531 if (_starting_thread == NULL) {
532 return false;
533 }
534 }
535
536 // The primordial thread is runnable from the start)
537 _starting_thread->set_state(RUNNABLE);
538
539 thread->set_osthread(_starting_thread);
540 return true;
541 }
542
543 // Helper function to trace _beginthreadex attributes,
544 // similar to os::Posix::describe_pthread_attr()
545 static char* describe_beginthreadex_attributes(char* buf, size_t buflen,
546 size_t stacksize, unsigned initflag) {
547 stringStream ss(buf, buflen);
548 if (stacksize == 0) {
549 ss.print("stacksize: default, ");
550 } else {
551 ss.print("stacksize: " SIZE_FORMAT "k, ", stacksize / 1024);
552 }
553 ss.print("flags: ");
554 #define PRINT_FLAG(f) if (initflag & f) ss.print( #f " ");
555 #define ALL(X) \
556 X(CREATE_SUSPENDED) \
557 X(STACK_SIZE_PARAM_IS_A_RESERVATION)
558 ALL(PRINT_FLAG)
559 #undef ALL
560 #undef PRINT_FLAG
561 return buf;
562 }
563
564 // Allocate and initialize a new OSThread
565 bool os::create_thread(Thread* thread, ThreadType thr_type,
566 size_t stack_size) {
567 unsigned thread_id;
568
569 // Allocate the OSThread object
570 OSThread* osthread = new OSThread(NULL, NULL);
571 if (osthread == NULL) {
572 return false;
573 }
574
|