[mapguide-commits] r4690 - sandbox/adsk/2.2gp/Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Mar 24 12:34:46 EDT 2010


Author: brucedechant
Date: 2010-03-24 12:34:46 -0400 (Wed, 24 Mar 2010)
New Revision: 4690

Modified:
   sandbox/adsk/2.2gp/Server/src/UnitTesting/TestTileService.cpp
Log:
Cleanup TileServer unit tests

Notes:
- Added Linux deadlock prevention code back with a small update to it


Modified: sandbox/adsk/2.2gp/Server/src/UnitTesting/TestTileService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/UnitTesting/TestTileService.cpp	2010-03-23 22:48:40 UTC (rev 4689)
+++ sandbox/adsk/2.2gp/Server/src/UnitTesting/TestTileService.cpp	2010-03-24 16:34:46 UTC (rev 4690)
@@ -30,11 +30,7 @@
 // define thread group for tiling tests
 #define THREAD_GROUP 65535
 
-#ifdef _WIN32
 static const INT32 MG_TEST_THREADS = 4;
-#else
-static const INT32 MG_TEST_THREADS = 4;
-#endif
 
 const STRING TEST_LOCALE = L"en";
 
@@ -425,10 +421,15 @@
             if (dc == numThreads)
                 break;
 
-            // wait 20ms or until all threads have finished
-            ACE_Time_Value t(0, 20000);
-            ACE_Time_Value future = ACE_OS::gettimeofday() + t;
-            manager->wait(&future);
+            // under Linux we get a deadlock if we don't call this every once in a while
+            if (nRequest % 25 == 0)
+                manager->wait_grp(THREAD_GROUP);
+            else
+            {
+                // pause briefly (10ms) before checking again
+                ACE_Time_Value t(0, 10000);
+                ACE_OS::sleep(t);
+            }
         }
 
         // make sure all threads in the group have completed
@@ -615,10 +616,15 @@
             if (dc == numThreads)
                 break;
 
-            // wait 20ms or until all threads have finished
-            ACE_Time_Value t(0, 20000);
-            ACE_Time_Value future = ACE_OS::gettimeofday() + t;
-            manager->wait(&future);
+            // under Linux we get a deadlock if we don't call this every once in a while
+            if (nRequest % 25 == 0)
+                manager->wait_grp(THREAD_GROUP);
+            else
+            {
+                // pause briefly (10ms) before checking again
+                ACE_Time_Value t(0, 10000);
+                ACE_OS::sleep(t);
+            }
         }
 
         // make sure all threads in the group have completed
@@ -673,10 +679,15 @@
             if (dc == numThreads)
                 break;
 
-            // wait 20ms or until all threads have finished
-            ACE_Time_Value t(0, 20000);
-            ACE_Time_Value future = ACE_OS::gettimeofday() + t;
-            manager->wait(&future);
+            // under Linux we get a deadlock if we don't call this every once in a while
+            if (nRequest % 25 == 0)
+                manager->wait_grp(THREAD_GROUP);
+            else
+            {
+                // pause briefly (10ms) before checking again
+                ACE_Time_Value t(0, 10000);
+                ACE_OS::sleep(t);
+            }
         }
 
         // make sure all threads in the group have completed
@@ -803,10 +814,15 @@
             if (dc == numThreads)
                 break;
 
-            // wait 20ms or until all threads have finished
-            ACE_Time_Value t(0, 20000);
-            ACE_Time_Value future = ACE_OS::gettimeofday() + t;
-            manager->wait(&future);
+            // under Linux we get a deadlock if we don't call this every once in a while
+            if (nRequest % 25 == 0)
+                manager->wait_grp(THREAD_GROUP);
+            else
+            {
+                // pause briefly (10ms) before checking again
+                ACE_Time_Value t(0, 10000);
+                ACE_OS::sleep(t);
+            }
         }
 
         // make sure all threads in the group have completed



More information about the mapguide-commits mailing list