Search Postgresql Archives

Re: server-side extension in c++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux