[libcxx-dev] exception_ptr reference counting

Shoaib Meenai via libcxx-dev libcxx-dev at lists.llvm.org
Mon Nov 18 20:06:38 PST 2019


I was looking at the wrong file. Thanks for the pointer and quick reply!

From: Eric Fiselier <eric at efcs.ca>
Date: Monday, November 18, 2019 at 7:12 PM
To: Shoaib Meenai <smeenai at fb.com>
Cc: Libc++ Dev <libcxx-dev at lists.llvm.org>
Subject: Re: [libcxx-dev] exception_ptr reference counting

The relevant implementation of exception_ptr is here (https://github.com/llvm-mirror/libcxx/blob/master/src/support/runtime/exception_pointer_cxxabi.ipp)

The exception header is reference counted, my very quick and dirty reading of the implementation suggests that we handle the reference counting correctly.

please let me know if I've overlooked something.


On Mon, Nov 18, 2019, 9:34 PM Shoaib Meenai via libcxx-dev <libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>> wrote:
According to cppreference [1]:

> The exception object referenced by an std::exception_ptr remains valid as long as there remains at least one std::exception_ptr that is referencing it: std::exception_ptr is a shared-ownership smart pointer

I don’t actually see any code in libc++’s implementation to prolong the lifetime of an exception object in case there are exception_ptrs pointing to it. I feel like I’m missing something obvious; how is this case handled?

[1] https://en.cppreference.com/w/cpp/error/exception_ptr<https://urldefense.proofpoint.com/v2/url?u=https-3A__en.cppreference.com_w_cpp_error_exception-5Fptr&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=VkjyXAuvjXpKf__9-xKnfAMLxP0JPRm6FDBryIjUaqw&s=sn4cT-nnVjBLwB3x9VvB7MdoYr7XLmxbVTTcG1VolR0&e=>
_______________________________________________
libcxx-dev mailing list
libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=VkjyXAuvjXpKf__9-xKnfAMLxP0JPRm6FDBryIjUaqw&s=_gIdEQ4hi3njB56qBEa-SO0y_Tyfsf-SldapOSyU3IM&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20191119/82b4ed16/attachment-0001.html>


More information about the libcxx-dev mailing list