Mercurial > projects > dwt-addons
diff dwtx/core/internal/jobs/ImplicitJobs.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 |
line wrap: on
line diff
--- a/dwtx/core/internal/jobs/ImplicitJobs.d Mon Sep 08 01:01:30 2008 +0200 +++ b/dwtx/core/internal/jobs/ImplicitJobs.d Tue Sep 09 15:59:16 2008 +0200 @@ -13,7 +13,7 @@ module dwtx.core.internal.jobs.ImplicitJobs; import tango.text.convert.Format; -import tango.core.Thread; +import dwtx.dwtxhelper.JThread; import tango.io.Stdout; import dwt.dwthelper.utils; import dwtx.dwtxhelper.Collection; @@ -65,7 +65,7 @@ void begin(ISchedulingRule rule, IProgressMonitor monitor, bool suspend) { if (JobManager.DEBUG_BEGIN_END) JobManager.debug_(Format("Begin rule: {}", rule)); //$NON-NLS-1$ - final Thread getThis = Thread.getThis(); + final JThread getThis = JThread.currentThread(); ThreadJob threadJob; synchronized (this) { threadJob = cast(ThreadJob) threadJobs.get(getThis); @@ -98,7 +98,7 @@ if (threadJob.acquireRule) { //no need to re-acquire any locks because the thread did not wait to get this lock if (manager.runNow_package(threadJob)) - manager.getLockManager().addLockThread(Thread.getThis(), rule); + manager.getLockManager().addLockThread(JThread.currentThread(), rule); else threadJob = threadJob.joinRun(monitor); } @@ -124,7 +124,7 @@ synchronized void end(ISchedulingRule rule, bool resume) { if (JobManager.DEBUG_BEGIN_END) JobManager.debug_(Format("End rule: {}", rule)); //$NON-NLS-1$ - ThreadJob threadJob = cast(ThreadJob) threadJobs.get(Thread.getThis()); + ThreadJob threadJob = cast(ThreadJob) threadJobs.get(JThread.currentThread()); if (threadJob is null) Assert.isLegal(rule is null, Format("endRule without matching beginRule: {}", rule)); //$NON-NLS-1$ else if (threadJob.pop(rule)) { @@ -138,7 +138,7 @@ * @param lastJob The last job to run in this thread */ void endJob(InternalJob lastJob) { - final Thread getThis = Thread.getThis(); + final JThread getThis = JThread.currentThread(); IStatus error; synchronized (this) { ThreadJob threadJob = cast(ThreadJob) threadJobs.get(getThis); @@ -161,7 +161,7 @@ } private void endThreadJob(ThreadJob threadJob, bool resume) { - Thread getThis = Thread.getThis(); + JThread getThis = JThread.currentThread(); //clean up when last rule scope exits threadJobs.remove(getThis); ISchedulingRule rule = threadJob.getRule(); @@ -251,11 +251,11 @@ /** * Implements IJobManager#transferRule(ISchedulingRule, Thread) */ - synchronized void transfer(ISchedulingRule rule, Thread destinationThread) { + synchronized void transfer(ISchedulingRule rule, JThread destinationThread) { //nothing to do for null if (rule is null) return; - Thread getThis = Thread.getThis(); + JThread getThis = JThread.currentThread(); //nothing to do if transferring to the same thread if (getThis is destinationThread) return;