mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-12-02 11:57:44 +08:00
Fix auxiliary thread problems related to multiple processes
This commit is contained in:
parent
25e75fc42c
commit
cb755e414f
@ -6,6 +6,8 @@
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "chassis-sql-log.h"
|
||||
#include "cetus-monitor.h"
|
||||
#include "network-mysqld.h"
|
||||
#include "cetus-channel.h"
|
||||
#include "cetus-process.h"
|
||||
@ -534,6 +536,10 @@ cetus_worker_process_cycle(cetus_cycle_t *cycle, void *data)
|
||||
incremental_guid_init(&(cycle->guid_state));
|
||||
#endif
|
||||
|
||||
cetus_monitor_start_thread(cycle->priv->monitor, cycle);
|
||||
cetus_sql_log_start_thread_once(cycle->sql_mgr);
|
||||
|
||||
|
||||
for ( ;; ) {
|
||||
|
||||
if (cetus_exiting) {
|
||||
@ -647,6 +653,8 @@ cetus_worker_process_exit(cetus_cycle_t *cycle)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
cetus_monitor_stop_thread(cycle->priv->monitor);
|
||||
|
||||
g_message("%s: exit", G_STRLOC);
|
||||
|
||||
exit(0);
|
||||
|
@ -634,7 +634,6 @@ init_parameters(struct chassis_frontend_t *frontend, chassis *srv)
|
||||
srv->default_db = DUP_STRING(frontend->default_db, NULL);
|
||||
srv->ifname = DUP_STRING(frontend->ifname, "eth0");
|
||||
|
||||
frontend->worker_processes = 1;
|
||||
if (frontend->worker_processes < 1) {
|
||||
srv->worker_processes = 4;
|
||||
} else if (frontend->worker_processes > MAX_WORK_PROCESSES) {
|
||||
@ -1220,17 +1219,12 @@ main_cmdline(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
cetus_monitor_start_thread(srv->priv->monitor, srv);
|
||||
cetus_sql_log_start_thread_once(srv->sql_mgr);
|
||||
|
||||
if (chassis_mainloop(srv)) {
|
||||
/* looks like we failed */
|
||||
g_critical("%s: Failure from chassis_mainloop. Shutting down.", G_STRLOC);
|
||||
GOTO_EXIT(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
cetus_monitor_stop_thread(srv->priv->monitor);
|
||||
|
||||
exit_nicely:
|
||||
/* necessary to set the shutdown flag, because the monitor will continue
|
||||
* to schedule timers otherwise, causing an infinite loop in cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user