Re: Closing OnLine session
Posted in 1997
>From: David Williams <djw@smooth1.demon.co.uk> >Date: Tue, 6 May 1997 19:25:52 +0100 >X-Informix-List-Id: <news.37738> > >Jonathan Leffler <johnl@informix.com> writes: >>David Williams <djw@smooth1.demon.co.uk> asks: >>>[...information about disconnecting a database engine using sqlexit()...] >>>>(4) DISCONNECT only works with 6.00 and later servers, whereas sqlexit() >>>> works with earlier versions too. >>> >>> What do you use to reconnect under 4GL version 4?? >>> Would a DATABASE <mydbname> reconnect you to the engine?? >> >>Yes! >> >>After sqlexit() is used, the ESQL/C library knows it has no active database >>connection, so it has to restart the engine when you run a DATABASE statement. > I have tried sqlexit but I my sqlexec turns into a defunct process. > If I do a wait afterwards the defunct process goes away and no errors > occur.. Hi, Ideally, sqlexec should not become defunct. However, on some machines and some versions of I4GL or ESQL/C, sqlexec can become a defunct (zombie) process. I have no details of platforms or versions; it is a sporadically re-appearing bug. Using wait() is one way of avoid the zombie process, but don't forget to allow for 'no children left'. Another is to use waitpid(), which is part of POSIX.1, so it's reasonably portable. There is a no waiting (WNOHANG) option to waitpid(), which allows better control of what's going on. You might have a second child process (other than sqlexec) which is meant to be there. If you aren't careful, wait() will hang your process waiting for this other child to die (and leading to a form of deadlock if the other child is waiting for your process to talk to it). Using waitpid() with no waiting avoids such problems. Yours, Jonathan Leffler (johnl@informix.com) #include <witticism.h>