comparison dwt/widgets/RunnableLock.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 1a8b3cb347e0 2952d5604c0a
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2000, 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 module dwt.widgets.RunnableLock;
12
13 import dwt.dwthelper.utils;
14
15
16 /**
17 * Instances of this class are used to ensure that an
18 * application cannot interfere with the locking mechanism
19 * used to implement asynchronous and synchronous communication
20 * between widgets and background threads.
21 */
22
23 class RunnableLock {
24 Runnable runnable;
25 Thread thread;
26 Throwable throwable;
27
28 RunnableLock (Runnable runnable) {
29 this.runnable = runnable;
30 }
31
32 bool done () {
33 return runnable is null || throwable !is null;
34 }
35
36 void run () {
37 if (runnable !is null) runnable.run ();
38 runnable = null;
39 }
40
41 }