[Listener] Use pthread_cleanup*
This commit is contained in:
parent
a3f0fb4130
commit
0a52205916
|
@ -1043,6 +1043,7 @@ void* autocalibrate_hello(void *NULL_value)
|
||||||
owlclient_create_trx_socket(GET_AGGREGATION_IP(),
|
owlclient_create_trx_socket(GET_AGGREGATION_IP(),
|
||||||
GET_AUTOCALIBRATION_PORT(),
|
GET_AUTOCALIBRATION_PORT(),
|
||||||
&serv, NULL) ;
|
&serv, NULL) ;
|
||||||
|
pthread_cleanup_push(&owl_close_fd, &send_sockfd) ;
|
||||||
|
|
||||||
memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, 6) ;
|
memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, 6) ;
|
||||||
|
|
||||||
|
@ -1053,7 +1054,8 @@ void* autocalibrate_hello(void *NULL_value)
|
||||||
sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ;
|
sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(send_sockfd) ;
|
/* Close the socket */
|
||||||
|
pthread_cleanup_pop(1) ;
|
||||||
|
|
||||||
pthread_exit(NULL_value) ;
|
pthread_exit(NULL_value) ;
|
||||||
}
|
}
|
||||||
|
@ -1087,6 +1089,7 @@ void* autocalibrate(void *NULL_value)
|
||||||
" aggregation server") ;
|
" aggregation server") ;
|
||||||
exit(ERR_CREATING_SOCKET) ;
|
exit(ERR_CREATING_SOCKET) ;
|
||||||
}
|
}
|
||||||
|
pthread_cleanup_push(&owl_close_fd, &listen_sockfd) ;
|
||||||
|
|
||||||
while (run)
|
while (run)
|
||||||
{
|
{
|
||||||
|
@ -1112,7 +1115,8 @@ void* autocalibrate(void *NULL_value)
|
||||||
"Autocalibration order unknown: %d.\n", message.order) ;
|
"Autocalibration order unknown: %d.\n", message.order) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(listen_sockfd) ;
|
/* Close the socket */
|
||||||
|
pthread_cleanup_pop(1) ;
|
||||||
|
|
||||||
pthread_exit(NULL_value) ;
|
pthread_exit(NULL_value) ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue