MXS-2196: Start listeners after worker threads

If the startup of the listeners requires communication with all of the
workers, the workers must be up and running for that to happen.

Due to the fact that the main thread is still a worker thread, the
initialization code is not extra straightforward. By queuing an event to
the main worker, the startup of all listeners is done at a fully
operational state with all workers fully functional.

The service initialization code was also flawed in the sense that it would
cause a deadlock if any of the threads would have to check for the user
permissions. This is mainly a problem with the authenticator modules but
the benefits of the per service pre-loading of users is most likely
superficial. In theory startup will be faster as each thread now queries
the users in parallel.
This commit is contained in:
Markus Mäkelä
2018-12-02 11:21:49 +02:00
parent 015c581a5b
commit 7aa60b4a24
4 changed files with 42 additions and 50 deletions

View File

@ -195,18 +195,9 @@ void service_destroy_instances(void);
* Initialize and start all services. This should only be called once by the
* main initialization code.
*
* @return Number of successfully started services or -1 on error
* @return False if a fatal error occurred
*/
int service_launch_all(void);
/**
* Perform thread-specific initialization
*
* Currently this function only pre-loads users for all threads.
*
* @return True on success, false on error (currently always returns true).
*/
bool service_thread_init();
bool service_launch_all(void);
/**
* @brief Remove a listener from use