hotspot/src/share/vm/runtime/mutex.cpp
changeset 34633 2a6c7c7b30a7
parent 33148 68fa8b6c4340
child 36357 953ab5f53cff
equal deleted inserted replaced
34632:bf3518bba285 34633:2a6c7c7b30a7
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
  1033 
  1033 
  1034   if (TryLock()) {
  1034   if (TryLock()) {
  1035  Exeunt:
  1035  Exeunt:
  1036     assert(ILocked(), "invariant");
  1036     assert(ILocked(), "invariant");
  1037     assert(_owner == NULL, "invariant");
  1037     assert(_owner == NULL, "invariant");
  1038     // This can potentially be called by non-java Threads. Thus, the ThreadLocalStorage
  1038     // This can potentially be called by non-java Threads. Thus, the Thread::current_or_null()
  1039     // might return NULL. Don't call set_owner since it will break on an NULL owner
  1039     // might return NULL. Don't call set_owner since it will break on an NULL owner
  1040     // Consider installing a non-null "ANON" distinguished value instead of just NULL.
  1040     // Consider installing a non-null "ANON" distinguished value instead of just NULL.
  1041     _owner = ThreadLocalStorage::thread();
  1041     _owner = Thread::current_or_null();
  1042     return;
  1042     return;
  1043   }
  1043   }
  1044 
  1044 
  1045   if (TrySpin(NULL)) goto Exeunt;
  1045   if (TrySpin(NULL)) goto Exeunt;
  1046 
  1046