Re: server-side extension in c++

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: server-side extension in c++
Дата
Msg-id 201006021406.o52E67L22129@momjian.us
обсуждение исходный текст
Ответ на Re: server-side extension in c++  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-general
Craig Ringer wrote:
> See the attached demo (pop all files in the same directory then run "make").
>
>
> > I would have
> > imagined that ultimately, the call to the Pg C function must return,
> > and therefore cannot affect stack unwinding within the C++ part of the
> > program.
>
> That's the whole point; a longjmp breaks the call chain, and the
> guarantee that eventually the stack will unwind as functions return.
>
> It's OK if you setjmp(a), do some work, setjmp(b), longjmp(a), do some
> work, longjmp(b), return.
>
> My understanding, which is likely imperfect, is that Pg's error handling
> does NOT guarantee that, ie it's quite possible that a function may call
> longjmp() without preparing any jmp_env to "jump back to" and therefore
> will never return.

You are correct that a longjump() jumps back to the query entry loop,
hopping over any user-defined C or C++ functions in the call stack, and
you are right that if we were just using longjump() without unwinding
C++ calls, we would be OK using non-POD structures.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + None of us is going to be here forever. +

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: postgres authentication against Windows Domain
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: PosttgreSQL on AIX