Wait until housekeeper has finished

When calling hkshutdown(), only a shutdown flag will be set.
In main() we will then actually wait for the housekeeper thread
to finish before exiting.
This commit is contained in:
Johan Wikman
2016-11-08 21:09:17 +02:00
parent ef79686a3a
commit 02ec7e9b17
4 changed files with 92 additions and 24 deletions

View File

@ -1936,7 +1936,13 @@ int main(int argc, char **argv)
/*
* Start the housekeeper thread
*/
hkinit();
if (!hkinit())
{
char* logerr = "Failed to start housekeeper thread.";
print_log_n_stderr(true, true, logerr, logerr, 0);
rc = MAXSCALE_INTERNALERROR;
goto return_main;
}
/*<
* Start the polling threads, note this is one less than is
@ -1974,6 +1980,11 @@ int main(int argc, char **argv)
*/
poll_waitevents((void *)0);
/*<
* Wait for the housekeeper to finish.
*/
hkfinish();
/*<
* Wait server threads' completion.
*/