changeset 695:3b17111499bf

Minor updates to the last commit.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 10 Mar 2011 19:36:47 +0000
parents 130ca42c4ae3
children 516e0c09d4b9
files mac/dw.m
diffstat 1 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Thu Mar 10 18:58:05 2011 +0000
+++ b/mac/dw.m	Thu Mar 10 19:36:47 2011 +0000
@@ -1718,18 +1718,18 @@
         gettimeofday(&tv, NULL);
         
         dw_mutex_lock(DWRunMutex);
+        if(orig == (DWTID)-1)
+        {
+            DWThread = curr;
+        }
         while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds)
         {
-            if(orig == (DWTID)-1)
-            {
-                DWThread = curr;
-            }
-            dw_main_iteration();
-            if(orig == (DWTID)-1)
-            {
-                DWThread = orig;
-            }
-            gettimeofday(&tv, NULL);
+             dw_main_iteration();
+             gettimeofday(&tv, NULL);
+        }
+        if(orig == (DWTID)-1)
+        {
+            DWThread = orig;
         }
         dw_mutex_unlock(DWRunMutex);
     }
@@ -6503,12 +6503,10 @@
      */
     if(DWThread == pthread_self())
     {
-        pthread_mutex_unlock(DWRunMutex);
         while(pthread_mutex_trylock(mutex) != 0)
         {
             dw_main_iteration();
         }
-        pthread_mutex_lock(DWRunMutex);
     }
     else
     {