hotspot/src/share/vm/runtime/objectMonitor.inline.hpp
changeset 15234 ff1f01be5fbd
parent 7397 5b173b4ca846
child 27165 785a8d56024c
--- a/hotspot/src/share/vm/runtime/objectMonitor.inline.hpp	Tue Jan 22 05:55:04 2013 -0800
+++ b/hotspot/src/share/vm/runtime/objectMonitor.inline.hpp	Tue Jan 22 05:56:42 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -101,10 +101,12 @@
   return _count;
 }
 
+// Do NOT set _count = 0. There is a race such that _count could
+// be set while inflating prior to setting _owner
+// Just use Atomic::inc/dec and assert 0 when monitor put on free list
 inline void ObjectMonitor::set_owner(void* owner) {
   _owner = owner;
   _recursions = 0;
-  _count = 0;
 }