diff dwtx/core/internal/jobs/LockManager.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/LockManager.d	Mon Sep 08 01:01:30 2008 +0200
+++ b/dwtx/core/internal/jobs/LockManager.d	Tue Sep 09 15:59:16 2008 +0200
@@ -12,7 +12,7 @@
  *******************************************************************************/
 module dwtx.core.internal.jobs.LockManager;
 
-import tango.core.Thread;
+import dwtx.dwtxhelper.JThread;
 import dwt.dwthelper.utils;
 import dwtx.dwtxhelper.Collection;
 
@@ -115,7 +115,7 @@
     /* (non-Javadoc)
      * Method declared on LockListener
      */
-    public bool aboutToWait(Thread lockOwner) {
+    public bool aboutToWait(JThread lockOwner) {
         if (lockListener is null)
             return false;
         try {
@@ -131,7 +131,7 @@
     /**
      * This thread has just acquired a lock.  Update graph.
      */
-    void addLockThread(Thread thread, ISchedulingRule lock) {
+    void addLockThread(JThread thread, ISchedulingRule lock) {
         if (locks is null)
             return;
         try {
@@ -146,7 +146,7 @@
     /**
      * This thread has just been refused a lock.  Update graph and check for deadlock.
      */
-    void addLockWaitThread(Thread thread, ISchedulingRule lock) {
+    void addLockWaitThread(JThread thread, ISchedulingRule lock) {
         if (locks is null)
             return;
         try {
@@ -220,13 +220,13 @@
     public bool isLockOwner() {
         //all job threads have to be treated as lock owners because UI thread
         //may try to join a job
-        Thread current = Thread.getThis();
+        JThread current = JThread.currentThread();
         if (cast(Worker)current )
             return true;
         if (locks is null)
             return false;
         synchronized (locks) {
-            return locks.contains(Thread.getThis());
+            return locks.contains(JThread.currentThread());
         }
     }
 
@@ -240,7 +240,7 @@
     /**
      * Releases all the acquires that were called on the given rule. Needs to be called only once.
      */
-    void removeLockCompletely(Thread thread, ISchedulingRule rule) {
+    void removeLockCompletely(JThread thread, ISchedulingRule rule) {
         if (locks is null)
             return;
         try {
@@ -255,7 +255,7 @@
     /**
      * This thread has just released a lock.  Update graph.
      */
-    void removeLockThread(Thread thread, ISchedulingRule lock) {
+    void removeLockThread(JThread thread, ISchedulingRule lock) {
         try {
             synchronized (locks) {
                 locks.lockReleased(thread, lock);
@@ -268,7 +268,7 @@
     /**
      * This thread has just stopped waiting for a lock. Update graph.
      */
-    void removeLockWaitThread(Thread thread, ISchedulingRule lock) {
+    void removeLockWaitThread(JThread thread, ISchedulingRule lock) {
         try {
             synchronized (locks) {
                 locks.lockWaitStop(thread, lock);
@@ -281,7 +281,7 @@
     /**
      * Resumes all the locks that were suspended while this thread was waiting to acquire another lock.
      */
-    void resumeSuspendedLocks(Thread owner) {
+    void resumeSuspendedLocks(JThread owner) {
         LockState[] toResume;
         synchronized (suspendedLocks) {
             Stack prevLocks = cast(Stack) suspendedLocks.get(owner);