Split server stop() and join()
For consistency with the other components, call stop() and join() separately. This allows to stop all components, then join them all.
This commit is contained in:
parent
e30e692b36
commit
c78254fcd1
3 changed files with 11 additions and 0 deletions
|
@ -698,6 +698,10 @@ end:
|
||||||
sc_file_pusher_destroy(&s->file_pusher);
|
sc_file_pusher_destroy(&s->file_pusher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (server_started) {
|
||||||
|
sc_server_join(&s->server);
|
||||||
|
}
|
||||||
|
|
||||||
sc_server_destroy(&s->server);
|
sc_server_destroy(&s->server);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -909,7 +909,10 @@ sc_server_stop(struct sc_server *server) {
|
||||||
sc_cond_signal(&server->cond_stopped);
|
sc_cond_signal(&server->cond_stopped);
|
||||||
sc_intr_interrupt(&server->intr);
|
sc_intr_interrupt(&server->intr);
|
||||||
sc_mutex_unlock(&server->mutex);
|
sc_mutex_unlock(&server->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sc_server_join(struct sc_server *server) {
|
||||||
sc_thread_join(&server->thread, NULL);
|
sc_thread_join(&server->thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,10 @@ sc_server_start(struct sc_server *server);
|
||||||
void
|
void
|
||||||
sc_server_stop(struct sc_server *server);
|
sc_server_stop(struct sc_server *server);
|
||||||
|
|
||||||
|
// join the server thread
|
||||||
|
void
|
||||||
|
sc_server_join(struct sc_server *server);
|
||||||
|
|
||||||
// close and release sockets
|
// close and release sockets
|
||||||
void
|
void
|
||||||
sc_server_destroy(struct sc_server *server);
|
sc_server_destroy(struct sc_server *server);
|
||||||
|
|
Loading…
Reference in a new issue