From: Jeff E. <JEm...@lg...> - 2003-11-17 21:49:04
|
>I asked the question again because I thought the make_synchronize() >method would only work for a thread that was created using the >start_new_thread() method, and not using the Java Thread object. That's a fair assumption. Since the jython documentation is somewhat lacking in areas, I often refer to the source code to understand how something works. The source for make_synchronized is pretty simple: public static PyObject make_synchronized(PyObject callable) { return new SynchronizedCallable(callable); } and SynchronizedCallable has a __call__ operator to call the argument callable's __call__ meethod in a synchronized block like this: synchronized(synchronize._getSync(arg)) { return callable.__call__(arg); } Since this is synchronized in Java, it will be thread-safe for Java threads. |