Message1290

Author leouserz
Recipients
Date 2006-12-21.18:25:08
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
this patch makes sense.  Id also include having the name set as well to the Java thread to match the Python thread.

patch:
--- /org/python/modules/thread.java	Thu Dec 21 12:26:01 2006
+++ org/python/modules/thread.java	Thu Dec 21 12:25:23 2006
@@ -23,6 +23,7 @@
             Py.printException(exc);

         }
 
     }

+
 }

 

 public class thread implements ClassDictInit

@@ -41,6 +42,20 @@
 

     public static void start_new_thread(PyObject func, PyTuple args) {

         Thread pt = new FunctionThread(func, args.getArray());

+        PyObject im_self = func.__findattr__("im_self");
+        if(im_self != null){
+            PyObject isDaemon = im_self.__findattr__("isDaemon");
+            if(isDaemon != null && isDaemon.isCallable()){
+                PyObject po = isDaemon.__call__();
+                if(po.__nonzero__())
+	            pt.setDaemon(true);
+	    }
+            PyObject getName = im_self.__findattr__("getName");
+            if(getName != null && getName.isCallable()){
+                PyObject pname = getName.__call__();
+                pt.setName(String.valueOf(pname));
+            }
+        }
         pt.start();

     }

 



leouser
History
Date User Action Args
2008-02-20 17:17:35adminlinkissue1603253 messages
2008-02-20 17:17:35admincreate