[Jython-checkins] jython (2.5): #1805: Giving threading.Threads unique names
alan.kennedy
jython-checkins at python.org
Sun Apr 1 18:08:15 CEST 2012
http://hg.python.org/jython/rev/920a60f5d5b5
changeset: 6520:920a60f5d5b5
branch: 2.5
parent: 6510:c514ff14cef5
user: Alan Kennedy <alan at xhaus.com>
date: Sun Apr 01 16:58:59 2012 +0100
summary:
#1805: Giving threading.Threads unique names
files:
NEWS | 1 +
src/org/python/core/FunctionThread.java | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@
Jython 2.5.3b2
Bugs Fixed
+ - [ 1805 ] threading.Thread always gets name "Thread" instead of a discriminating one
- [ 1866 ] Parser does not have mismatch token error messages caught by BaseRecognizer
- [ 1837 ] gderived.py and template Ant target fail on Windows
- [ 1536 ] NPE in org.python.jsr223.PyScriptEngine:187
diff --git a/src/org/python/core/FunctionThread.java b/src/org/python/core/FunctionThread.java
--- a/src/org/python/core/FunctionThread.java
+++ b/src/org/python/core/FunctionThread.java
@@ -1,5 +1,7 @@
package org.python.core;
+import java.util.concurrent.atomic.AtomicInteger;
+
import org.python.modules._systemrestart;
public class FunctionThread extends Thread
@@ -7,12 +9,14 @@
private final PyObject func;
private final PyObject[] args;
private final PySystemState systemState;
+ private static AtomicInteger counter = new AtomicInteger();
public FunctionThread(PyObject func, PyObject[] args, long stack_size, ThreadGroup group) {
super(group, null, "Thread", stack_size);
this.func = func;
this.args = args;
this.systemState = Py.getSystemState();
+ this.setName("Thread-"+Integer.toString(counter.incrementAndGet()));
}
public void run() {
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list