--- libaitio/src/sock.c 2013/08/27 19:07:55 1.2.2.3 +++ libaitio/src/sock.c 2013/08/27 19:25:59 1.2.2.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: sock.c,v 1.2.2.3 2013/08/27 19:07:55 misho Exp $ +* $Id: sock.c,v 1.2.2.5 2013/08/27 19:25:59 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -207,6 +207,7 @@ thrCliClean(void *arg) { sock_cli_t *cli = (sock_cli_t*) arg; + shutdown(cli->cli_fd, SHUT_RDWR); close(cli->cli_fd); AIT_FREE_VAL(&cli->cli_buf); e_free(cli); @@ -215,10 +216,15 @@ thrCliClean(void *arg) static void * io_thrCliWrapper(void *arg) { + void *ret; + sock_cli_t *cli = (sock_cli_t*) arg; + pthread_cleanup_push(thrCliClean, arg); + ret = cli->cli_func(cli); + pthread_cleanup_pop(42); - pthread_exit(NULL); + pthread_exit(ret); } /*