Mercurial > projects > dwt-addons
comparison dwtx/core/internal/jobs/Semaphore.d @ 167:862b05e0334a
Add a wrapper for Thread
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 09 Sep 2008 15:59:16 +0200 |
parents | 9d0585bcb7aa |
children |
comparison
equal
deleted
inserted
replaced
163:e5dd0081ccba | 167:862b05e0334a |
---|---|
10 * Port to the D programming language: | 10 * Port to the D programming language: |
11 * Frank Benoit <benoit@tionex.de> | 11 * Frank Benoit <benoit@tionex.de> |
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module dwtx.core.internal.jobs.Semaphore; | 13 module dwtx.core.internal.jobs.Semaphore; |
14 | 14 |
15 import tango.core.Thread; | 15 import dwtx.dwtxhelper.JThread; |
16 import tango.core.sync.Mutex; | 16 import tango.core.sync.Mutex; |
17 import tango.core.sync.Condition; | 17 import tango.core.sync.Condition; |
18 import dwt.dwthelper.utils; | 18 import dwt.dwthelper.utils; |
19 import dwt.dwthelper.Runnable; | 19 import dwt.dwthelper.Runnable; |
20 import tango.text.convert.Format; | 20 import tango.text.convert.Format; |
21 | 21 |
22 public class Semaphore { | 22 public class Semaphore { |
23 protected long notifications; | 23 protected long notifications; |
24 protected Thread runnable; | 24 protected JThread runnable; |
25 | 25 |
26 private Mutex mutex; | 26 private Mutex mutex; |
27 private Condition condition; | 27 private Condition condition; |
28 | 28 |
29 public this(Thread runnable) { | 29 public this(JThread runnable) { |
30 mutex = new Mutex; | 30 mutex = new Mutex; |
31 condition = new Condition(mutex); | 31 condition = new Condition(mutex); |
32 this.runnable = runnable; | 32 this.runnable = runnable; |
33 notifications = 0; | 33 notifications = 0; |
34 } | 34 } |