| OLD | NEW |
| 1 package org.python.core; | 1 package org.python.core; |
| 2 | 2 |
| 3 public class FunctionThread extends Thread | 3 public class FunctionThread extends Thread |
| 4 { | 4 { |
| 5 private final PyObject func; | 5 private final PyObject func; |
| 6 private final PyObject[] args; | 6 private final PyObject[] args; |
| 7 private final PySystemState systemState; | 7 private final PySystemState systemState; |
| 8 | 8 |
| 9 public FunctionThread(PyObject func, PyObject[] args) { | 9 public FunctionThread(PyObject func, PyObject[] args, long stack_size, Threa
dGroup group) { |
| 10 super(); | 10 super(group, null, "Thread", stack_size); |
| 11 this.func = func; | 11 this.func = func; |
| 12 this.args = args; | 12 this.args = args; |
| 13 this.systemState = Py.getSystemState(); | 13 this.systemState = Py.getSystemState(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 public FunctionThread(PyObject func, PyObject[] args, long stack_size) { | |
| 17 super(null, null, "Thread", stack_size); | |
| 18 this.func = func; | |
| 19 this.args = args; | |
| 20 this.systemState = Py.getSystemState(); | |
| 21 } | |
| 22 | |
| 23 public void run() { | 16 public void run() { |
| 24 Py.setSystemState(systemState); | 17 Py.setSystemState(systemState); |
| 25 try { | 18 try { |
| 26 func.__call__(args); | 19 func.__call__(args); |
| 27 } catch (PyException exc) { | 20 } catch (PyException exc) { |
| 28 if (Py.matchException(exc, Py.SystemExit)) { | 21 if (Py.matchException(exc, Py.SystemExit) || |
| 22 Py.matchException(exc, Py.SystemRestart)) { |
| 29 return; | 23 return; |
| 30 } | 24 } |
| 31 Py.stderr.println("Unhandled exception in thread started by " + func
); | 25 Py.stderr.println("Unhandled exception in thread started by " + func
); |
| 32 Py.printException(exc); | 26 Py.printException(exc); |
| 33 } | 27 } |
| 34 } | 28 } |
| 35 } | 29 } |
| OLD | NEW |