[libcxx] r204678 - Add a test to make sure we're doing the right thing for throwing exceptions from deferred functions. This is LWG issue #2186. No change to the library needed.

Marshall Clow mclow.lists at gmail.com
Mon Mar 24 15:25:24 PDT 2014


Author: marshall
Date: Mon Mar 24 17:25:24 2014
New Revision: 204678

URL: http://llvm.org/viewvc/llvm-project?rev=204678&view=rev
Log:
Add a test to make sure we're doing the right thing for throwing exceptions from deferred functions. This is LWG issue #2186. No change to the library needed.

Modified:
    libcxx/trunk/test/thread/futures/futures.async/async.pass.cpp
    libcxx/trunk/www/cxx1y_status.html

Modified: libcxx/trunk/test/thread/futures/futures.async/async.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/futures/futures.async/async.pass.cpp?rev=204678&r1=204677&r2=204678&view=diff
==============================================================================
--- libcxx/trunk/test/thread/futures/futures.async/async.pass.cpp (original)
+++ libcxx/trunk/test/thread/futures/futures.async/async.pass.cpp Mon Mar 24 17:25:24 2014
@@ -55,6 +55,12 @@ std::unique_ptr<int> f4(std::unique_ptr<
     return std::move(p);
 }
 
+void f5(int i)
+{
+    std::this_thread::sleep_for(ms(200));
+    throw i;
+}
+
 int main()
 {
     {
@@ -174,4 +180,17 @@ int main()
         Clock::time_point t1 = Clock::now();
         assert(t1-t0 < ms(100));
     }
+
+    {
+        std::future<void> f = std::async(f5, 3);
+        std::this_thread::sleep_for(ms(300));
+        try { f.get(); assert (false); } catch ( int ex ) {}
+    }
+
+    {
+        std::future<void> f = std::async(std::launch::deferred, f5, 3);
+        std::this_thread::sleep_for(ms(300));
+        try { f.get(); assert (false); } catch ( int ex ) {}
+    }
+
 }

Modified: libcxx/trunk/www/cxx1y_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1y_status.html?rev=204678&r1=204677&r2=204678&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1y_status.html (original)
+++ libcxx/trunk/www/cxx1y_status.html Mon Mar 24 17:25:24 2014
@@ -266,7 +266,7 @@
 	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2359">2359</a></td><td>How does regex_constants::nosubs affect basic_regex::mark_count()?</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360">2360</a></td><td>reverse_iterator::operator*() is unimplementable</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2104">2104</a></td><td>unique_lock move-assignment should not be noexcept</td><td>Issaquah</td><td>Complete</td></tr>
-	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2186">2186</a></td><td>Incomplete action on async/launch::deferred</td><td>Issaquah</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2186">2186</a></td><td>Incomplete action on async/launch::deferred</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2075">2075</a></td><td>Progress guarantees, lock-free property, and scheduling assumptions</td><td>Issaquah</td><td></td></tr>
 	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2288">2288</a></td><td>Inconsistent requirements for shared mutexes</td><td>Issaquah</td><td>Complete</td></tr>
 <!-- 	<tr><td></td><td></td><td></td><td></td></tr> -->





More information about the cfe-commits mailing list