diff dwt/widgets/RunnableLock.d @ 37:642f460a0908

Fixed a lot of compile errors, a "hello world" app compiles now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 10 Oct 2008 12:29:48 +0200
parents 5b53d338c709
children 07399639c0c8
line wrap: on
line diff
--- a/dwt/widgets/RunnableLock.d	Tue Oct 07 12:56:18 2008 +0200
+++ b/dwt/widgets/RunnableLock.d	Fri Oct 10 12:29:48 2008 +0200
@@ -9,16 +9,19 @@
  *     IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *     Jacob Carlborg <jacob.carlborg@gmail.com>
  *******************************************************************************/
 module dwt.widgets.RunnableLock;
 
+import tango.core.Exception;
+import tango.core.sync.Condition;
+import tango.core.sync.Mutex;
 import tango.core.Thread;
 
 import dwt.dwthelper.Runnable;
 import dwt.dwthelper.utils;
 
-
 /**
  * Instances of this class are used to ensure that an
  * application cannot interfere with the locking mechanism
@@ -26,13 +29,16 @@
  * between widgets and background threads.
  */
 
-class RunnableLock {
+class RunnableLock : Mutex {
     Runnable runnable;
     Thread thread;
     Throwable throwable;
     
+    Condition cond;
+    
 this (Runnable runnable) {
     this.runnable = runnable;
+    this.cond = new Condition(this);
 }
 
 bool done () {
@@ -43,5 +49,12 @@
     if (runnable !is null) runnable.run ();
     runnable = null;
 }
+    
+void notifyAll(){
+    cond.notifyAll();
+}
+void wait(){
+    cond.wait();
+}
 
 }