Java Objects vs Pythons?

Arinté shouldbe at message.com
Fri Jun 23 12:04:30 EDT 2000


I want to do a wait object like in java.  I know Python has Lock and RLock,
but I am not sure on how to use it (not in tutorial).  This is for an
embedded app.  What I want to do is in the script it says wait for the C++
app to tell it it is ok to run.  So, I envision something like this

waitObject = ???<What type of Lock should I use
def callbackNotify():
    waitObject.acquire()
    waitObject.notifyAll()
    waitObject.release()

...
#main do some stuff
waitObject.acquire()
waitObject.wait()
waitObject.release()

In the script I don't create any threads or anything, can I do a wait object
without creating a thread (pretty sure you can't do that in java)?  I guess
there kinda is a thread because there is the python script and then there is
the C++ app with the callback(usually waiting for output to finish on a
printer).  What kind of Lock would be best the Lock or RLock or other?

thanx





More information about the Python-list mailing list