src/share/vm/runtime/mutex.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hsx-gc Sdiff src/share/vm/runtime

src/share/vm/runtime/mutex.cpp

Print this page
rev 3849 : imported patch thread.inline.hpp


   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "runtime/mutex.hpp"
  28 #include "runtime/osThread.hpp"

  29 #include "utilities/events.hpp"
  30 #ifdef TARGET_OS_FAMILY_linux
  31 # include "mutex_linux.inline.hpp"
  32 # include "thread_linux.inline.hpp"
  33 #endif
  34 #ifdef TARGET_OS_FAMILY_solaris
  35 # include "mutex_solaris.inline.hpp"
  36 # include "thread_solaris.inline.hpp"
  37 #endif
  38 #ifdef TARGET_OS_FAMILY_windows
  39 # include "mutex_windows.inline.hpp"
  40 # include "thread_windows.inline.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_bsd
  43 # include "mutex_bsd.inline.hpp"
  44 # include "thread_bsd.inline.hpp"
  45 #endif
  46 
  47 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
  48 //
  49 // Native Monitor-Mutex locking - theory of operations
  50 //
  51 // * Native Monitors are completely unrelated to Java-level monitors,
  52 //   although the "back-end" slow-path implementations share a common lineage.
  53 //   See objectMonitor:: in synchronizer.cpp.
  54 //   Native Monitors do *not* support nesting or recursion but otherwise
  55 //   they're basically Hoare-flavor monitors.
  56 //
  57 // * A thread acquires ownership of a Monitor/Mutex by CASing the LockByte
  58 //   in the _LockWord from zero to non-zero.  Note that the _Owner field
  59 //   is advisory and is used only to verify that the thread calling unlock()
  60 //   is indeed the last thread to have acquired the lock.
  61 //
  62 // * Contending threads "push" themselves onto the front of the contention
  63 //   queue -- called the cxq -- with CAS and then spin/park.
  64 //   The _LockWord contains the LockByte as well as the pointer to the head




   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "runtime/mutex.hpp"
  28 #include "runtime/osThread.hpp"
  29 #include "runtime/thread.inline.hpp"
  30 #include "utilities/events.hpp"
  31 #ifdef TARGET_OS_FAMILY_linux
  32 # include "mutex_linux.inline.hpp"

  33 #endif
  34 #ifdef TARGET_OS_FAMILY_solaris
  35 # include "mutex_solaris.inline.hpp"

  36 #endif
  37 #ifdef TARGET_OS_FAMILY_windows
  38 # include "mutex_windows.inline.hpp"

  39 #endif
  40 #ifdef TARGET_OS_FAMILY_bsd
  41 # include "mutex_bsd.inline.hpp"

  42 #endif
  43 
  44 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
  45 //
  46 // Native Monitor-Mutex locking - theory of operations
  47 //
  48 // * Native Monitors are completely unrelated to Java-level monitors,
  49 //   although the "back-end" slow-path implementations share a common lineage.
  50 //   See objectMonitor:: in synchronizer.cpp.
  51 //   Native Monitors do *not* support nesting or recursion but otherwise
  52 //   they're basically Hoare-flavor monitors.
  53 //
  54 // * A thread acquires ownership of a Monitor/Mutex by CASing the LockByte
  55 //   in the _LockWord from zero to non-zero.  Note that the _Owner field
  56 //   is advisory and is used only to verify that the thread calling unlock()
  57 //   is indeed the last thread to have acquired the lock.
  58 //
  59 // * Contending threads "push" themselves onto the front of the contention
  60 //   queue -- called the cxq -- with CAS and then spin/park.
  61 //   The _LockWord contains the LockByte as well as the pointer to the head


src/share/vm/runtime/mutex.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File