DCE-RPC, pthreads, ESQL-C (spec. cancelation of pthread should break a current sql request)
Posted in 1998
Hi there, I've a problem concerning the interaction between DCE-RPC, pthreads and ESQL-C. We employ DCE clients and servers which communicate via RPC. The RPCs on the server side (aka manager code) do access an informix database via ESQL-C code. So far so good. The client issues an rpc via a pthread. The RPC is forwarded to the server with in turn accesses the database (with database, select ..., ). The client now is able to cancel the thread and a signal is forwarded to the server to cancel the pending rpc. The manager code of the server catches a signal to break further processing: code fragment of server manager code: #include <dce OnSqlBreakCallback(int nStatus) { switch (nStatus) { case 0: printf("Request finished..."); break; case 1: printf("Request started..."); break; case 2: printf("Request timed out..."); break; } } my_routine(/* List of Parameters */) { . sqlbreakcallback(500, OnSqlBreakCallback); . . TRY { /* make the SQL requests to the * database */ DATABASE... PREPARE... EXECUTE... FREE... CLOSE... } CATCH(pthread_cancel_e) { if (sqldone() == -439) // server busy ??? sqlbreak(); } ENDTRY } During normal execution OnSqlBreakCallback is called regulary as expected... The signal is catched well and the code between CATCH and ENDTRY is executed well (sqlbreak() returns normally 0 which means, that the current request has been canceled. (After that the OnSqlBreakCallback is never called: No further SQL command in progress...???) The problem is that subsequent rpc calls to the database (means any SQL statement between TRY and CATCH) always returns with code -439 (database is currently processing an sql task). It seems that the SQL statement sqlbreak() has not made a break correctly (althought it reported so). What I am doing wrong or what has to be done in addition to get the things done ? Now, the server has to be shutdown and started again. But this is no solution in the long run... BTW: In the meantime I got an answer to use longjmp and setjmp : But I done know how to use them in this aboev printed context. If anyone could be of further assistance please let me know. Any help is highly appreciated. Thanks in advance -- johannes ************************************************* Johannes Plassmann c/o Siemens Nixdorf Informationssysteme AG SNI ITS LOG RC61 Heinz-Nixdorf-Ring 33106 Paderborn, Germany Phone: +49 5251 8-25825 Fax: +49 5251 8-27199 NERV: plassmann.pad Internet: plassmann.pad@sni.de