--- libaitrpc/src/srv.c 2010/07/08 08:02:02 1.1.1.1.2.19 +++ libaitrpc/src/srv.c 2010/07/08 13:05:50 1.1.1.1.2.21 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.1.1.1.2.19 2010/07/08 08:02:02 misho Exp $ +* $Id: srv.c,v 1.1.1.1.2.21 2010/07/08 13:05:50 misho Exp $ * *************************************************************************/ #include "global.h" @@ -411,6 +411,7 @@ rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv) } pthread_mutex_unlock(&srv->srv_blob.mtx); + while (pthread_mutex_trylock(&srv->srv_blob.mtx) == EBUSY); pthread_mutex_destroy(&srv->srv_blob.mtx); } @@ -579,12 +580,12 @@ rpc_srv_initServer(u_int regProgID, u_int regProcID, i } else memset(srv->srv_clients, 0, srv->srv_numcli * sizeof(rpc_cli_t)); + pthread_mutex_init(&srv->srv_mtx, NULL); + rpc_srv_registerCall(srv, NULL, CALL_SRVSHUTDOWN, 0); rpc_srv_registerCall(srv, NULL, CALL_SRVCLIENTS, 0); rpc_srv_registerCall(srv, NULL, CALL_SRVCALLS, 0); rpc_srv_registerCall(srv, NULL, CALL_SRVSESSIONS, 0); - - pthread_mutex_init(&srv->srv_mtx, NULL); return srv; } @@ -625,6 +626,7 @@ rpc_srv_endServer(rpc_srv_t * __restrict srv) } pthread_mutex_unlock(&srv->srv_mtx); + while (pthread_mutex_trylock(&srv->srv_mtx) == EBUSY); pthread_mutex_destroy(&srv->srv_mtx); free(srv);