mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-35574 remove obsolete pthread_exit calls
Threads can normally exit without a explicit pthread_exit call.
There seem to date to old glibc bugs, many around 2.2.5.
The semi related bug was https://bugs.mysql.com/bug.php?id=82886.
To improve safety in the signal handlers DBUG_* code was removed.
These where also needed to avoid some MSAN unresolved stack issues.
This is effectively a backport of 2719cc4925
.
This commit is contained in:
@@ -631,7 +631,6 @@ error:
|
|||||||
pthread_cond_signal(&count_threshhold);
|
pthread_cond_signal(&count_threshhold);
|
||||||
pthread_mutex_unlock(&counter_mutex);
|
pthread_mutex_unlock(&counter_mutex);
|
||||||
mysql_thread_end();
|
mysql_thread_end();
|
||||||
pthread_exit(0);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -991,7 +991,6 @@ end_thread:
|
|||||||
cn->mysql= 0;
|
cn->mysql= 0;
|
||||||
cn->query_done= 1;
|
cn->query_done= 1;
|
||||||
mysql_thread_end();
|
mysql_thread_end();
|
||||||
pthread_exit(0);
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -566,8 +566,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
|
|||||||
alarm_thread_running= 0;
|
alarm_thread_running= 0;
|
||||||
mysql_cond_signal(&COND_alarm);
|
mysql_cond_signal(&COND_alarm);
|
||||||
mysql_mutex_unlock(&LOCK_alarm);
|
mysql_mutex_unlock(&LOCK_alarm);
|
||||||
pthread_exit(0);
|
return 0;
|
||||||
return 0; /* Impossible */
|
|
||||||
}
|
}
|
||||||
#endif /* USE_ALARM_THREAD */
|
#endif /* USE_ALARM_THREAD */
|
||||||
#endif
|
#endif
|
||||||
|
@@ -330,8 +330,7 @@ static void *timer_handler(void *arg __attribute__((unused)))
|
|||||||
}
|
}
|
||||||
mysql_mutex_unlock(&LOCK_timer);
|
mysql_mutex_unlock(&LOCK_timer);
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
return 0;
|
||||||
return 0; /* Impossible */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -290,7 +290,6 @@ pthread_handler_t background_thread(void *arg __attribute__((unused)))
|
|||||||
}
|
}
|
||||||
|
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2948,7 +2948,6 @@ pthread_handler_t signal_hand(void *)
|
|||||||
sigset_t set;
|
sigset_t set;
|
||||||
int sig;
|
int sig;
|
||||||
my_thread_init(); // Init new thread
|
my_thread_init(); // Init new thread
|
||||||
DBUG_ENTER("signal_hand");
|
|
||||||
signal_thread_in_use= 1;
|
signal_thread_in_use= 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3014,7 +3013,6 @@ pthread_handler_t signal_hand(void *)
|
|||||||
/* switch to the old log message processing */
|
/* switch to the old log message processing */
|
||||||
logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE,
|
logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE,
|
||||||
opt_log ? LOG_FILE:LOG_NONE);
|
opt_log ? LOG_FILE:LOG_NONE);
|
||||||
DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop));
|
|
||||||
|
|
||||||
break_connect_loop();
|
break_connect_loop();
|
||||||
DBUG_ASSERT(abort_loop);
|
DBUG_ASSERT(abort_loop);
|
||||||
@@ -3050,12 +3048,9 @@ pthread_handler_t signal_hand(void *)
|
|||||||
break; /* purecov: tested */
|
break; /* purecov: tested */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBUG_PRINT("quit", ("signal_handler: calling my_thread_end()"));
|
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
DBUG_LEAVE; // Must match DBUG_ENTER()
|
|
||||||
signal_thread_in_use= 0;
|
signal_thread_in_use= 0;
|
||||||
pthread_exit(0); // Safety
|
return nullptr;
|
||||||
return(0); /* purecov: deadcode */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_data_home(const char *path)
|
static void check_data_home(const char *path)
|
||||||
|
@@ -271,12 +271,7 @@ error_exit_in_thread(intptr_t code)
|
|||||||
CRITICAL_SECTION_ENTER(grntest_cs);
|
CRITICAL_SECTION_ENTER(grntest_cs);
|
||||||
grntest_stop_flag = 1;
|
grntest_stop_flag = 1;
|
||||||
CRITICAL_SECTION_LEAVE(grntest_cs);
|
CRITICAL_SECTION_LEAVE(grntest_cs);
|
||||||
#ifdef WIN32
|
return code;
|
||||||
_endthreadex(code);
|
|
||||||
#else
|
|
||||||
pthread_exit((void *)code);
|
|
||||||
#endif /* WIN32 */
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -70,7 +70,6 @@ end:
|
|||||||
thread_count--;
|
thread_count--;
|
||||||
pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
|
pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
|
||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
pthread_exit(0);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,7 +91,6 @@ pthread_handler_t thread_stack_check(void *arg __attribute__((unused)))
|
|||||||
test_stack_detection(1, STACK_ALLOC_SMALL_BLOCK_SIZE-1);
|
test_stack_detection(1, STACK_ALLOC_SMALL_BLOCK_SIZE-1);
|
||||||
test_stack_detection(2, STACK_ALLOC_SMALL_BLOCK_SIZE+1);
|
test_stack_detection(2, STACK_ALLOC_SMALL_BLOCK_SIZE+1);
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -108,7 +108,6 @@ void *test_apc_service_thread(void *ptr)
|
|||||||
apc_target.destroy();
|
apc_target.destroy();
|
||||||
mysql_mutex_destroy(&target_mutex);
|
mysql_mutex_destroy(&target_mutex);
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user