I start a TNonblockingServer from one thread:
void *start_server(void *) {
server->serve();
return NULL;
}
pthread_create(&daemon_thread, NULL, start_server, NULL);
, and call server->stop() from the main thread, then try to use pthread_join to wait the background thread exiting gracefully. However the main thread hangs at the pthread_join call.
How could I shut down the thrift server gracefully?
Sorry for the late response
You would just need to stop the underlying libevent
For example, a slightly delayed stop: