Re: Proposal for Prototype Implementation to Enhance C/C++ Interoperability in PostgreSQL

Поиск
Список
Период
Сортировка
От 盏一
Тема Re: Proposal for Prototype Implementation to Enhance C/C++ Interoperability in PostgreSQL
Дата
Msg-id tencent_5E4A400F23994D0D5C93CAE7@qq.com
обсуждение исходный текст
Ответ на Re: Proposal for Prototype Implementation to Enhance C/C++ Interoperability in PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
(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
[ItaniumC++ 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_exitis also implemented using _Unwind_ForcedUnwind.
 

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

> 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
pointfor 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
exceptionsmust 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
theprocess. In our code, this path is rarely taken, and once we encounter an exception that is not caught, we will fix
thecode 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, 盏一

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Add two missing tests in 035_standby_logical_decoding.pl
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: [DOC] Update ALTER SUBSCRIPTION documentation