stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r548123 - /incubator/stdcxx/trunk/tests/strings/21.string.cons.mt.cpp
Date Sun, 17 Jun 2007 22:06:37 GMT
Author: sebor
Date: Sun Jun 17 15:06:36 2007
New Revision: 548123

URL: http://svn.apache.org/viewvc?view=rev&rev=548123
Log:
2007-06-17  Martin Sebor  <sebor@roguewave.com>

	* 21.string.cons.mt.cpp [!_RWSTD_REENTRANT](rw_opt_nthreads): Set
	to 1 in "single-threaded" builds.
	(run_test): Added rw_error() calls checking the successful creation
	of thread pools.

Modified:
    incubator/stdcxx/trunk/tests/strings/21.string.cons.mt.cpp

Modified: incubator/stdcxx/trunk/tests/strings/21.string.cons.mt.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.cons.mt.cpp?view=diff&rev=548123&r1=548122&r2=548123
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.cons.mt.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.cons.mt.cpp Sun Jun 17 15:06:36 2007
@@ -86,8 +86,15 @@
 
 /**************************************************************************/
 
+#ifdef _RWSTD_REENTRANT
 int rw_opt_nthreads = 4;
-int rw_opt_nloops   = MAX_LOOPS;
+#else   // if !defined (_RWSTD_REENTRANT)
+// in non-threaded builds use just one thread
+int rw_opt_nthreads = 1;
+#endif   // _RWSTD_REENTRANT
+
+// the number of times each thread should iterate
+int rw_opt_nloops = MAX_LOOPS;
 
 
 template <class T>
@@ -192,13 +199,17 @@
     int result =
         rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
 
+    rw_error (result == 0, 0, __LINE__,
+              "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
+              rw_opt_nthreads, thread_func);
+
     for (std::size_t i = 0; i != nstrings; ++i) {
 
         const std::size_t size =
             std::string::traits_type::length (data [i]);
 
         rw_assert (size == shared [i].size (), 0, 0,
-                   "shared string modifed from #s to %{#S}",
+                   "shared string modifed from %#s to %{#S}",
                    data [i], &shared [i]);
     }
 
@@ -213,16 +224,20 @@
     test_wstring = true;
 
     // start a pool of threads to exercise wstring thread safety
-    result +=
+    result =
         rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
 
+    rw_error (result == 0, 0, __LINE__,
+              "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
+              rw_opt_nthreads, thread_func);
+
     for (std::size_t i = 0; i != nstrings; ++i) {
 
         const std::size_t size =
             std::wstring::traits_type::length (wdata [i]);
 
         rw_assert (size == wshared [i].size (), 0, 0,
-                   "shared string modifed from #ls to %{#lS}",
+                   "shared string modifed from %#ls to %{#lS}",
                    wdata [i], &wshared [i]);
     }
 



Mime
View raw message