From: Israel T. <it...@gm...> - 2010-11-25 06:15:37
|
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: self.lock.wait() There might be a way to do this with Java facilities, I'm not sure. Look at http://www.jython.org/jythonbook/en/1.0/Concurrency.html for more details. Israel On Thu, Nov 25, 2010 at 1:34 AM, Zemian Deng <sal...@gm...> wrote: > Hello, > > 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 { > lock.wait(); > } catch (Exception e) { throw new RuntimeException(e); } > } > } > } > > Thanks, > - 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. > http://p.sf.net/sfu/intelisp-dev2dev > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > |