# HG changeset patch # User Frank Benoit # Date 1202588567 -3600 # Node ID 00cab3126f7f60ecfae2f5882744d7d5276e04c3 # Parent 3948d75b83703f111bf6094b6db294e54256059b Implemented RunnableLock diff -r 3948d75b8370 -r 00cab3126f7f dwt/widgets/RunnableLock.d --- a/dwt/widgets/RunnableLock.d Sat Feb 09 21:22:22 2008 +0100 +++ b/dwt/widgets/RunnableLock.d Sat Feb 09 21:22:47 2008 +0100 @@ -15,6 +15,8 @@ import tango.core.Thread; import dwt.dwthelper.Runnable; import tango.core.Exception; +import tango.core.sync.Condition; +import tango.core.sync.Mutex; /** * Instances of this class are used to ensure that an @@ -23,13 +25,16 @@ * between widgets and background threads. */ -class RunnableLock { +class RunnableLock : Mutex { Runnable runnable; Thread thread; TracedException throwable; + Condition cond; + this (Runnable runnable) { this.runnable = runnable; + this.cond = new Condition(this); } bool done () { @@ -41,11 +46,11 @@ runnable = null; } -//PORTING_FIXME: How to emulate Java locking? void notifyAll(){ + cond.notifyAll(); } -//PORTING_FIXME: How to emulate Java locking? void wait(){ + cond.wait(); } }