346 if (!SafepointTimeout || timeout_error_printed) { 347 Safepoint_lock->wait(true); // true, means with no safepoint checks 348 } else { 349 // Compute remaining time 350 jlong remaining_time = safepoint_limit_time - os::javaTimeNanos(); 351 352 // If there is no remaining time, then there is an error 353 if (remaining_time < 0 || Safepoint_lock->wait(true, remaining_time / MICROUNITS)) { 354 print_safepoint_timeout(_blocking_timeout); 355 } 356 } 357 } 358 assert(_waiting_to_block == 0, "sanity check"); 359 360 #ifndef PRODUCT 361 if (SafepointTimeout) { 362 jlong current_time = os::javaTimeNanos(); 363 if (safepoint_limit_time < current_time) { 364 tty->print_cr("# SafepointSynchronize: Finished after " 365 INT64_FORMAT_W(6) " ms", 366 ((current_time - safepoint_limit_time) / MICROUNITS + 367 (jlong)SafepointTimeoutDelay)); 368 } 369 } 370 #endif 371 372 assert((_safepoint_counter & 0x1) == 0, "must be even"); 373 assert(Threads_lock->owned_by_self(), "must hold Threads_lock"); 374 _safepoint_counter ++; 375 376 // Record state 377 _state = _synchronized; 378 379 OrderAccess::fence(); 380 381 if (wait_blocked_event.should_commit()) { 382 wait_blocked_event.set_safepointId(safepoint_counter()); 383 wait_blocked_event.set_runningThreadCount(initial_waiting_to_block); 384 wait_blocked_event.commit(); 385 } 386 } // EventSafepointWaitBlocked 387 | 346 if (!SafepointTimeout || timeout_error_printed) { 347 Safepoint_lock->wait(true); // true, means with no safepoint checks 348 } else { 349 // Compute remaining time 350 jlong remaining_time = safepoint_limit_time - os::javaTimeNanos(); 351 352 // If there is no remaining time, then there is an error 353 if (remaining_time < 0 || Safepoint_lock->wait(true, remaining_time / MICROUNITS)) { 354 print_safepoint_timeout(_blocking_timeout); 355 } 356 } 357 } 358 assert(_waiting_to_block == 0, "sanity check"); 359 360 #ifndef PRODUCT 361 if (SafepointTimeout) { 362 jlong current_time = os::javaTimeNanos(); 363 if (safepoint_limit_time < current_time) { 364 tty->print_cr("# SafepointSynchronize: Finished after " 365 INT64_FORMAT_W(6) " ms", 366 (int64_t)((current_time - safepoint_limit_time) / MICROUNITS + 367 (jlong)SafepointTimeoutDelay)); 368 } 369 } 370 #endif 371 372 assert((_safepoint_counter & 0x1) == 0, "must be even"); 373 assert(Threads_lock->owned_by_self(), "must hold Threads_lock"); 374 _safepoint_counter ++; 375 376 // Record state 377 _state = _synchronized; 378 379 OrderAccess::fence(); 380 381 if (wait_blocked_event.should_commit()) { 382 wait_blocked_event.set_safepointId(safepoint_counter()); 383 wait_blocked_event.set_runningThreadCount(initial_waiting_to_block); 384 wait_blocked_event.commit(); 385 } 386 } // EventSafepointWaitBlocked 387 |