Mercurial > projects > dwt-mac
diff dwt/widgets/Synchronizer.d @ 15:2952d5604c0a
Ported some widgets, added some stuff to the runtime bindings
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 29 Aug 2008 21:46:05 +0200 |
parents | 380af2bdd8e5 |
children | 5b53d338c709 |
line wrap: on
line diff
--- a/dwt/widgets/Synchronizer.d Sat Aug 23 13:49:00 2008 +0200 +++ b/dwt/widgets/Synchronizer.d Fri Aug 29 21:46:05 2008 +0200 @@ -7,16 +7,25 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.widgets.Synchronizer; -import dwt.dwthelper.utils; - import dwt.DWT; import dwt.DWTException; import dwt.graphics.Device; import dwt.internal.Compatibility; + +import tango.core.Thread; +import tango.core.Exception; + +import dwt.dwthelper.Runnable; +import dwt.dwthelper.utils; +import dwt.widgets.Display; +import dwt.widgets.RunnableLock; /** * Instances of this class provide synchronization support @@ -41,18 +50,18 @@ RunnableLock [] messages; Object messageLock = new Object (); Thread syncThread; - static final int GROW_SIZE = 4; - static final int MESSAGE_LIMIT = 64; + static const int GROW_SIZE = 4; + static const int MESSAGE_LIMIT = 64; //TEMPORARY CODE - static final bool IS_CARBON = "carbon".equals (DWT.getPlatform ()); + static const bool IS_CARBON = "carbon".equals (DWT.getPlatform ()); /** * Constructs a new instance of this class. * * @param display the display to create the synchronizer on */ -public Synchronizer (Display display) { +public this (Display display) { this.display = display; } @@ -161,7 +170,7 @@ */ protected void syncExec (Runnable runnable) { RunnableLock lock = null; - synchronized (Device.class) { + synchronized (Device.classinfo) { if (display is null || display.isDisposed ()) DWT.error (DWT.ERROR_DEVICE_DISPOSED); if (!display.isValidThread ()) { if (runnable is null) { @@ -172,7 +181,7 @@ /* * Only remember the syncThread for syncExec. */ - lock.thread = Thread.currentThread(); + lock.thread = Thread.getThis(); addLast (lock); } }