src/share/classes/java/lang/Thread.java
Print this page
@@ -143,11 +143,11 @@
private static native void registerNatives();
static {
registerNatives();
}
- private char name[];
+ private volatile char name[];
private int priority;
private Thread threadQ;
private long eetop;
/* Whether or not to single_step this thread. */
@@ -1133,11 +1133,11 @@
* @exception SecurityException if the current thread cannot modify this
* thread.
* @see #getName
* @see #checkAccess()
*/
- public final void setName(String name) {
+ public final synchronized void setName(String name) {
checkAccess();
this.name = name.toCharArray();
if (threadStatus != 0) {
setNativeName(name);
}