wolkykim/libasyncd

crash while calling ad_server_stop

Opened this issue · 1 comments

Hi,
i have started 6 server threads which are running independantly, and there is a need for me to stop them at some instance of execution. while i was invoking the function ad_server_stop(server*) the code was getting stuck at : pthread_join function.
"Waiting server's last loop to finish"

But after modifying the code like below it started working.
if (server->thread) {
void *retval = NULL;
DEBUG("Waiting server's last loop to finish.");
pthread_join((server->thread), &retval); //// earlier the argument to this function was (*pthread_t) which is wrong , it should be just pthread_t.
free(retval);
free(server->thread);
server->thread = NULL;
}

Nice catch. Can you please send a PR for this fix?