child process exit handler
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Jan 2007 14:03:15 +0000 (14:03 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Jan 2007 14:03:15 +0000 (14:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6819 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_cstore.c

index e8c0492..2fe370b 100644 (file)
@@ -25,6 +25,7 @@
 
 int osrfAppChildInit();
 int osrfAppInitialize();
+void osrfAppChildExit();
 
 int verifyObjectClass ( osrfMethodContext*, jsonObject* );
 
@@ -68,6 +69,24 @@ jsonObject* jsonNULL = NULL; //
 /* parse and store the IDL here */
 osrfHash* idl;
 
+/* called when this process is about to exit */
+void osrfAppChildExit() {
+       osrfLogDebug(OSRF_LOG_MARK, "Child is exiting, disconnecting from database...");
+
+       if (writehandle) {
+               dbi_conn_query(writehandle, "ROLLBACK;");
+               dbi_conn_close(writehandle);
+               writehandle = NULL;
+       }
+
+       if (dbhandle)
+               dbi_conn_close(dbhandle);
+
+       // XXX add cleanup of readHandles whenever that gets used
+
+       return;
+}
+
 int osrfAppInitialize() {
        growing_buffer* method_name;