From: <pj...@us...> - 2008-05-18 23:00:34
|
Revision: 4422 http://jython.svn.sourceforge.net/jython/?rev=4422&view=rev Author: pjenvey Date: 2008-05-18 16:00:22 -0700 (Sun, 18 May 2008) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/jython/src/org/python/modules/thread/PyLock.java trunk/jython/src/org/python/modules/thread/thread.java Modified: trunk/jython/src/org/python/modules/thread/PyLock.java =================================================================== --- trunk/jython/src/org/python/modules/thread/PyLock.java 2008-05-18 22:51:09 UTC (rev 4421) +++ trunk/jython/src/org/python/modules/thread/PyLock.java 2008-05-18 23:00:22 UTC (rev 4422) @@ -1,12 +1,13 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.modules.thread; -import org.python.core.*; +import org.python.core.Py; +import org.python.core.PyObject; public class PyLock extends PyObject { - private boolean locked=false; - //private Object lock = new Object(); + private boolean locked = false; + public boolean acquire() { return acquire(true); } @@ -34,7 +35,8 @@ public synchronized void release() { if (locked) { - locked = false; notifyAll(); + locked = false; + notifyAll(); } else { throw Py.ValueError("lock not acquired"); } Modified: trunk/jython/src/org/python/modules/thread/thread.java =================================================================== --- trunk/jython/src/org/python/modules/thread/thread.java 2008-05-18 22:51:09 UTC (rev 4421) +++ trunk/jython/src/org/python/modules/thread/thread.java 2008-05-18 23:00:22 UTC (rev 4422) @@ -1,9 +1,18 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.modules.thread; -import org.python.core.*; -public class thread implements ClassDictInit -{ +import org.python.core.ClassDictInit; +import org.python.core.FunctionThread; +import org.python.core.Py; +import org.python.core.PyException; +import org.python.core.PyInteger; +import org.python.core.PyObject; +import org.python.core.PyString; +import org.python.core.PyType; +import org.python.core.PyTuple; + +public class thread implements ClassDictInit { + public static PyString __doc__ = new PyString( "This module provides primitive operations to write multi-threaded "+ "programs.\n" + @@ -12,7 +21,7 @@ public static void classDictInit(PyObject dict) { dict.__setitem__("LockType", PyType.fromClass(PyLock.class)); - dict.__setitem__("_local", PyLocal.TYPE); + dict.__setitem__("_local", PyLocal.TYPE); } public static PyObject error = new PyString("thread.error"); @@ -34,7 +43,7 @@ } pt.start(); } - + public static PyLock allocate_lock() { return new PyLock(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |