equal
deleted
inserted
replaced
505 |
505 |
506 assert (_OnDeck == ESelf, "invariant") ; |
506 assert (_OnDeck == ESelf, "invariant") ; |
507 _OnDeck = NULL ; |
507 _OnDeck = NULL ; |
508 |
508 |
509 // Note that we current drop the inner lock (clear OnDeck) in the slow-path |
509 // Note that we current drop the inner lock (clear OnDeck) in the slow-path |
510 // epilog immediately after having acquired the outer lock. |
510 // epilogue immediately after having acquired the outer lock. |
511 // But instead we could consider the following optimizations: |
511 // But instead we could consider the following optimizations: |
512 // A. Shift or defer dropping the inner lock until the subsequent IUnlock() operation. |
512 // A. Shift or defer dropping the inner lock until the subsequent IUnlock() operation. |
513 // This might avoid potential reacquisition of the inner lock in IUlock(). |
513 // This might avoid potential reacquisition of the inner lock in IUlock(). |
514 // B. While still holding the inner lock, attempt to opportunistically select |
514 // B. While still holding the inner lock, attempt to opportunistically select |
515 // and unlink the next ONDECK thread from the EntryList. |
515 // and unlink the next ONDECK thread from the EntryList. |
929 // Try a brief spin to avoid passing thru thread state transition ... |
929 // Try a brief spin to avoid passing thru thread state transition ... |
930 if (TrySpin (Self)) goto Exeunt ; |
930 if (TrySpin (Self)) goto Exeunt ; |
931 |
931 |
932 check_block_state(Self); |
932 check_block_state(Self); |
933 if (Self->is_Java_thread()) { |
933 if (Self->is_Java_thread()) { |
934 // Horribile dictu - we suffer through a state transition |
934 // Horrible dictu - we suffer through a state transition |
935 assert(rank() > Mutex::special, "Potential deadlock with special or lesser rank mutex"); |
935 assert(rank() > Mutex::special, "Potential deadlock with special or lesser rank mutex"); |
936 ThreadBlockInVM tbivm ((JavaThread *) Self) ; |
936 ThreadBlockInVM tbivm ((JavaThread *) Self) ; |
937 ILock (Self) ; |
937 ILock (Self) ; |
938 } else { |
938 } else { |
939 // Mirabile dictu |
939 // Mirabile dictu |
961 void Monitor::lock_without_safepoint_check () { |
961 void Monitor::lock_without_safepoint_check () { |
962 lock_without_safepoint_check (Thread::current()) ; |
962 lock_without_safepoint_check (Thread::current()) ; |
963 } |
963 } |
964 |
964 |
965 |
965 |
966 // Returns true if thread succeceed [sic] in grabbing the lock, otherwise false. |
966 // Returns true if thread succeeds in grabbing the lock, otherwise false. |
967 |
967 |
968 bool Monitor::try_lock() { |
968 bool Monitor::try_lock() { |
969 Thread * const Self = Thread::current(); |
969 Thread * const Self = Thread::current(); |
970 debug_only(check_prelock_state(Self)); |
970 debug_only(check_prelock_state(Self)); |
971 // assert(!thread->is_inside_signal_handler(), "don't lock inside signal handler"); |
971 // assert(!thread->is_inside_signal_handler(), "don't lock inside signal handler"); |