433 434 // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit 435 static intx current_thread_id(); 436 static int current_process_id(); 437 static int sleep(Thread* thread, jlong ms, bool interruptable); 438 // Short standalone OS sleep suitable for slow path spin loop. 439 // Ignores Thread.interrupt() (so keep it short). 440 // ms = 0, will sleep for the least amount of time allowed by the OS. 441 static void naked_short_sleep(jlong ms); 442 static void infinite_sleep(); // never returns, use with CAUTION 443 static void yield(); // Yields to all threads with same priority 444 enum YieldResult { 445 YIELD_SWITCHED = 1, // caller descheduled, other ready threads exist & ran 446 YIELD_NONEREADY = 0, // No other runnable/ready threads. 447 // platform-specific yield return immediately 448 YIELD_UNKNOWN = -1 // Unknown: platform doesn't support _SWITCHED or _NONEREADY 449 // YIELD_SWITCHED and YIELD_NONREADY imply the platform supports a "strong" 450 // yield that can be used in lieu of blocking. 451 } ; 452 static YieldResult NakedYield () ; 453 static void yield_all(int attempts = 0); // Yields to all other threads including lower priority 454 static void loop_breaker(int attempts); // called from within tight loops to possibly influence time-sharing 455 static OSReturn set_priority(Thread* thread, ThreadPriority priority); 456 static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority); 457 458 static void interrupt(Thread* thread); 459 static bool is_interrupted(Thread* thread, bool clear_interrupted); 460 461 static int pd_self_suspend_thread(Thread* thread); 462 463 static ExtendedPC fetch_frame_from_context(void* ucVoid, intptr_t** sp, intptr_t** fp); 464 static frame fetch_frame_from_context(void* ucVoid); 465 466 static ExtendedPC get_thread_pc(Thread *thread); 467 static void breakpoint(); 468 469 static address current_stack_pointer(); 470 static address current_stack_base(); 471 static size_t current_stack_size(); 472 473 static void verify_stack_alignment() PRODUCT_RETURN; 474 | 433 434 // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit 435 static intx current_thread_id(); 436 static int current_process_id(); 437 static int sleep(Thread* thread, jlong ms, bool interruptable); 438 // Short standalone OS sleep suitable for slow path spin loop. 439 // Ignores Thread.interrupt() (so keep it short). 440 // ms = 0, will sleep for the least amount of time allowed by the OS. 441 static void naked_short_sleep(jlong ms); 442 static void infinite_sleep(); // never returns, use with CAUTION 443 static void yield(); // Yields to all threads with same priority 444 enum YieldResult { 445 YIELD_SWITCHED = 1, // caller descheduled, other ready threads exist & ran 446 YIELD_NONEREADY = 0, // No other runnable/ready threads. 447 // platform-specific yield return immediately 448 YIELD_UNKNOWN = -1 // Unknown: platform doesn't support _SWITCHED or _NONEREADY 449 // YIELD_SWITCHED and YIELD_NONREADY imply the platform supports a "strong" 450 // yield that can be used in lieu of blocking. 451 } ; 452 static YieldResult NakedYield () ; 453 static void yield_all(); // Yields to all other threads including lower priority 454 // (for the default scheduling policy) 455 static OSReturn set_priority(Thread* thread, ThreadPriority priority); 456 static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority); 457 458 static void interrupt(Thread* thread); 459 static bool is_interrupted(Thread* thread, bool clear_interrupted); 460 461 static int pd_self_suspend_thread(Thread* thread); 462 463 static ExtendedPC fetch_frame_from_context(void* ucVoid, intptr_t** sp, intptr_t** fp); 464 static frame fetch_frame_from_context(void* ucVoid); 465 466 static ExtendedPC get_thread_pc(Thread *thread); 467 static void breakpoint(); 468 469 static address current_stack_pointer(); 470 static address current_stack_base(); 471 static size_t current_stack_size(); 472 473 static void verify_stack_alignment() PRODUCT_RETURN; 474 |