File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ void UNLOCK_SETTING(void) {
8585 pthread_mutex_unlock(&setting_lock);
8686}
8787
88+ static pthread_mutex_t shutdown_lock = PTHREAD_MUTEX_INITIALIZER;
8889volatile sig_atomic_t memcached_shutdown=0;
8990
9091/*
@@ -14541,7 +14542,11 @@ static void remove_pidfile(const char *pid_file)
1454114542
1454214543static void shutdown_server(void)
1454314544{
14544- memcached_shutdown = 1;
14545+ pthread_mutex_lock(&shutdown_lock);
14546+ if (memcached_shutdown == 0) {
14547+ memcached_shutdown = 1;
14548+ }
14549+ pthread_mutex_unlock(&shutdown_lock);
1454514550}
1454614551
1454714552static void sigterm_handler(int sig)
@@ -15824,7 +15829,9 @@ int main (int argc, char **argv)
1582415829 mc_logger->log(EXTENSION_LOG_INFO, NULL, "Listen sockets closed.\n");
1582515830
1582615831 /* 4) shutdown all threads */
15832+ pthread_mutex_lock(&shutdown_lock);
1582715833 memcached_shutdown = 2;
15834+ pthread_mutex_unlock(&shutdown_lock);
1582815835 threads_shutdown();
1582915836 release_independent_stats(default_thread_stats);
1583015837 if (default_topkeys) {
You can’t perform that action at this time.
0 commit comments