Commit b90ff534 authored by Guilhem Bichot's avatar Guilhem Bichot

Fixing problems of previous 5.1-main->5.1-maria merge:

- adding back Serg's "mtr --list-options"
- safe_mutex deadlock detector started raising wrong deadlock warnings, fixed
here by a backport from 6.0-main.

include/my_pthread.h:
  Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
  in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
mysql-test/mysql-test-run.pl:
  adding back Serg's --list-options
mysys/my_init.c:
  Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
  in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
mysys/my_thr_init.c:
  Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
  in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
parent 704b4845
......@@ -671,6 +671,7 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
typedef ulong my_thread_id;
extern void my_threadattr_global_init(void);
extern my_bool my_thread_global_init(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
......
......@@ -118,6 +118,7 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,maria";
our $opt_usage;
our $opt_list_options;
our $opt_suites;
our $opt_suites_default= "main,backup,backup_engines,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
our $opt_script_debug= 0; # Script debugging, enable with --script-debug
......@@ -770,7 +771,7 @@ sub command_line_setup {
# Read the command line options
# Note: Keep list, and the order, in sync with usage at end of this file
Getopt::Long::Configure("pass_through");
GetOptions(
my %options=(
# Control what engine/variation to run
'embedded-server' => \$opt_embedded_server,
'ps-protocol' => \$opt_ps_protocol,
......@@ -891,9 +892,13 @@ sub command_line_setup {
'timediff' => \&report_option,
'help|h' => \$opt_usage,
) or usage("Can't read options");
'list-options' => \$opt_list_options,
);
GetOptions(%options) or usage("Can't read options");
usage("") if $opt_usage;
list_options(\%options) if $opt_list_options;
# --------------------------------------------------------------------------
# Setup verbosity
......@@ -5125,3 +5130,15 @@ HERE
}
sub list_options ($) {
my $hash= shift;
for (keys %$hash) {
s/(=.*|!)$//;
s/\|/\n--/g;
print "--$_\n";
}
exit(1);
}
......@@ -82,20 +82,20 @@ my_bool my_init(void)
my_progname_short= my_progname + dirname_length(my_progname);
#if defined(THREAD)
if (my_thread_global_init())
return 1;
(void) my_threadattr_global_init();
# if defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */
# endif
#endif
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
# elif defined(MY_PTHREAD_FASTMUTEX)
fastmutex_global_init(); /* Must be called early */
# endif
#endif
netware_init();
#ifdef THREAD
#if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */
#endif
if (my_thread_global_init())
return 1;
#if !defined( __WIN__) && !defined(__NETWARE__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
......
......@@ -65,6 +65,38 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))
#endif /* TARGET_OS_LINUX */
/**
Initialize thread attributes.
*/
void my_threadattr_global_init(void)
{
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
/*
Set mutex type to "fast" a.k.a "adaptive"
In this case the thread may steal the mutex from some other thread
that is waiting for the same mutex. This will save us some
context switches but may cause a thread to 'starve forever' while
waiting for the mutex (not likely if the code within the mutex is
short).
*/
pthread_mutexattr_init(&my_fast_mutexattr); /* ?= MY_MUTEX_INIT_FAST */
pthread_mutexattr_settype(&my_fast_mutexattr,
PTHREAD_MUTEX_ADAPTIVE_NP);
#endif
#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
/*
Set mutex type to "errorcheck"
*/
pthread_mutexattr_init(&my_errorcheck_mutexattr);
pthread_mutexattr_settype(&my_errorcheck_mutexattr,
PTHREAD_MUTEX_ERRORCHECK);
#endif
}
static uint get_thread_lib(void);
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment