[PATCH] D24159: Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 06:23:10 PDT 2016


bcraig added inline comments.

================
Comment at: src/condition_variable.cpp:86
@@ +85,3 @@
+    if (tl_ptr.get() == nullptr) {
+        tl_ptr.set_pointer(new __thread_struct);
+    }
----------------
The standard synopsis of notify_all_at_thread_exit in the standard doesn't have a "Throws:" clause.  I think that means that this is non-conformant.

There is some phrasing in 30.2.2 [thread.req.exception]:
   Failure to allocate storage shall be reported as described in 17.6.5.12 [res.on.exception.handling].
But I don't see wording in that section that gives permission to throw from functions without Throws clauses.

>From a user perspective, I generally expect my synchronization primitives to be no-throw.  I don't know if it is really possible to provide that guarantee with notify_all_at_thread_exit though, especially if we want it to work outside of a std::thread.


https://reviews.llvm.org/D24159





More information about the cfe-commits mailing list