--- libaitrpc/src/lists.c 2012/03/14 13:29:11 1.6.2.3 +++ libaitrpc/src/lists.c 2012/03/29 01:34:16 1.8 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: lists.c,v 1.6.2.3 2012/03/14 13:29:11 misho Exp $ +* $Id: lists.c,v 1.8 2012/03/29 01:34:16 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -166,13 +166,15 @@ rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, con if (rpc_calcHashes(&func, csModule, csFunc) == -1) return -1; + pthread_mutex_lock(&srv->srv_mtx); f = rpc_srv_getCall(srv, func.func_tag, func.func_hash); AIT_FREE_VAL(&func.func_name); AIT_FREE_VAL(&func.func_file); - if (!f) /* not found element for unregister */ + if (!f) { /* not found element for unregister */ + pthread_mutex_unlock(&srv->srv_mtx); return 0; + } - pthread_mutex_lock(&srv->srv_mtx); /* remove from list of functions */ if (srv->srv_funcs == f) /* if is 1st element */ srv->srv_funcs = srv->srv_funcs->func_next; @@ -362,7 +364,7 @@ rpc_calcHashes(rpc_func_t * __restrict func, const cha len += strlen(csModule); } /* align len to 2 */ - len = (len + 1) & ~1; + len = io_align(len, 1); /* prepare hash source string */ str = malloc(len);