(Sorry, there was a problem with the format of the previous email content. I 
will send it in plain text format this time

> It seems extremely specific to one particular C++ implementation

To perform a force unwind during longjmp, the _Unwind_ForcedUnwind function is 
used. This function is defined in the [Itanium C++ ABI 
Standard](https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#base-throw), 
which is followed by all C++ implementations. Additionally, the glibc 
[nptl/unwind.c](https://elixir.bootlin.com/glibc/latest/source/nptl/unwind.c#L130)
 file shows that on all platforms, pthread_exit is also implemented using 
_Unwind_ForcedUnwind.

Furthermore, the Itanium C++ ABI specification also defines 
_Unwind_RaiseException as the entry point for all C++ exceptions thrown.

> you've thrown in a new dependency on pthreads

The reason for the dependence on pthread is due to the overloading of 
_Unwind_RaiseException, which serves as the entry point for all C++ throwing 
exceptions. Some third-party C++ libraries may create threads internally and 
throw exceptions.

Overloading _Unwind_RaiseException is done to convert uncaught exceptions into 
elog(ERROR). If we require that all exceptions must be caught, we can remove 
the overloading of _Unwind_RaiseException and all pthread dependencies.

The overloading of _Unwind_RaiseException is just a fallback measure to prevent 
uncaught exceptions from terminating the process. In our code, this path is 
rarely taken, and once we encounter an exception that is not caught, we will 
fix the code to catch the exception.

> doesn't this require us to move our minimum language requirement to 
> C++-something?

No, all code has no dependency on C++.

regards, 盏一

Reply via email to