You can use Python's threading facilities. I think the following code is equivalent:

import threading

class SyncDemo(object):
    def __init__(self):
        self.lock = threading.Condition()

    def run():
        with self.lock:

There might be a way to do this with Java facilities, I'm not sure. Look at for more details.


On Thu, Nov 25, 2010 at 1:34 AM, Zemian Deng <> wrote:

I can't find doc on using Java's synchronized syntax in Jython. Can someone show me the Jython equivalent of the following Java code?

public class SyncDemo {
  Object lock = new Object();
  public void run() {
    synchronized(lock) {
      try {
      } catch (Exception e) { throw new RuntimeException(e); }

  - Z

Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
Jython-users mailing list