Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16)

Side by Side Diff: src/org/python/core/FunctionThread.java

Issue 2810: SystemRestart exception to restart the interpreter (Closed) SVN Base: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm
Patch Set: Created 1 year, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483