changeset 157:00cab3126f7f

Implemented RunnableLock
author Frank Benoit <benoit@tionex.de>
date Sat, 09 Feb 2008 21:22:47 +0100
parents 3948d75b8370
children de2578a843a7
files dwt/widgets/RunnableLock.d
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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();
 }
 
 }