Commit 2f54a73f by David Daney Committed by Tom Tromey

Reference.java (clear): Set referent to null and synchronize.

2003-09-19  David Daney <ddaney@avtrex.com>

	* java/lang/ref/Reference.java (clear): Set referent to null and
	synchronize.

From-SVN: r71597
parent f55f60a5
2003-09-19 David Daney <ddaney@avtrex.com>
* java/lang/ref/Reference.java (clear): Set referent to null and
synchronize.
2003-09-19 Michael Koch <konqueror@gmx.de> 2003-09-19 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/NIODatagramSocket.java, * gnu/java/nio/NIODatagramSocket.java,
......
...@@ -176,8 +176,13 @@ public abstract class Reference ...@@ -176,8 +176,13 @@ public abstract class Reference
*/ */
public void clear() public void clear()
{ {
// Must synchronize so changes are visible in finalizer thread.
synchronized (lock)
{
referent = null;
cleared = true; cleared = true;
} }
}
/** /**
* Tells if the object is enqueued on a reference queue. * Tells if the object is enqueued on a reference queue.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment