Mercurial > projects > dwt-mac
view dwt/widgets/RunnableLock.d @ 17:5b53d338c709
Fixed some errors after latest merge
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 29 Aug 2008 22:04:22 +0200 |
parents | 2952d5604c0a 1a8b3cb347e0 |
children | 642f460a0908 |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.widgets.RunnableLock; 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 * used to implement asynchronous and synchronous communication * between widgets and background threads. */ class RunnableLock { Runnable runnable; Thread thread; Throwable throwable; this (Runnable runnable) { this.runnable = runnable; } bool done () { return runnable is null || throwable !is null; } void run () { if (runnable !is null) runnable.run (); runnable = null; } }