src/share/vm/runtime/mutex.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/runtime/mutex.hpp	Wed Dec 10 11:28:21 2014
--- new/src/share/vm/runtime/mutex.hpp	Wed Dec 10 11:28:18 2014

*** 1,7 **** --- 1,7 ---- /* ! * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 152,161 **** --- 152,179 ---- _no_safepoint_check_flag = true, _allow_vm_block_flag = true, _as_suspend_equivalent_flag = true }; + // Locks can be acquired with or without safepoint check. + // Monitor::lock and Monitor::lock_without_safepoint_check + // checks these flags when acquiring a lock to ensure + // consistent checking for each lock. + // A few existing locks will sometimes have a safepoint check and + // sometimes not, but these locks are set up in such a way to avoid deadlocks. + enum SafepointCheckRequired { + _safepoint_check_never, // Monitors with this value will cause errors + // when acquired with a safepoint check. + _safepoint_check_sometimes, // Certain locks are called sometimes with and + // sometimes without safepoint checks. These + // locks will not produce errors when locked. + _safepoint_check_always // Causes error if locked without a safepoint + // check. + }; + + NOT_PRODUCT(SafepointCheckRequired _safepoint_check_required;) + enum WaitResults { CONDVAR_EVENT, // Wait returned because of condition variable notification INTERRUPT_EVENT, // Wait returned because waiting thread was interrupted NUMBER_WAIT_RESULTS };
*** 173,183 **** --- 191,202 ---- protected: static void ClearMonitor (Monitor * m, const char* name = NULL) ; Monitor() ; public: ! Monitor(int rank, const char *name, bool allow_vm_block=false); ! Monitor(int rank, const char *name, bool allow_vm_block = false, + SafepointCheckRequired safepoint_check_required = _safepoint_check_always); ~Monitor(); // Wait until monitor is notified (or times out). // Defaults are to make safepoint checks, wait time is forever (i.e., // zero), and not a suspend-equivalent condition. Returns true if wait
*** 259,269 **** --- 278,289 ---- // thread-specific park-unpark platform-specific primitives. class Mutex : public Monitor { // degenerate Monitor public: ! Mutex (int rank, const char *name, bool allow_vm_block=false); ! Mutex(int rank, const char *name, bool allow_vm_block = false, + SafepointCheckRequired safepoint_check_required = _safepoint_check_always); ~Mutex () ; private: bool notify () { ShouldNotReachHere(); return false; } bool notify_all() { ShouldNotReachHere(); return false; } bool wait (bool no_safepoint_check, long timeout, bool as_suspend_equivalent) {

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