Python "Event" equivalent in Java? -
What is the closest thing in Java (probably an idiom) in Python?
/.
Java for Or / 5
Edit: Because the Python specification is similar to how we generally wait for Java implementation:
class event {lock lock = New retract lock (); Condition condom = lock.newCondition (); Boolean flag; Public Zero doWait () throws throttled; Exception {lock.lock (); Try {while (Flag) {cond.await (); }} Finally {lock.unlock (); }} Public Zero Dualight (Float Second) throws blocking exception {lock.lock (); Try {while (Flag) {cond.await ((int * (seconds * 1000), TimeUnit.MILLISECONDS); }} Finally {lock.unlock (); }} Public Boolean Hasset () {lock.lock (); {Try Return Flag; } Finally {lock.unlock (); }} Public Zero Set () {lock.lock (); {Flag = true; Cond.signalAll (); } Finally {lock.unlock (); }} Public Zero Clear () {lock.lock (); Try {flag = false; Cond.signalAll (); } Finally {lock.unlock (); }}}
Comments
Post a Comment