Commit 5d3b8266 authored by unknown's avatar unknown
Browse files

Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.1

into  mysql.com:/home/kent/bk/tmp/mysql-5.1-build

parents 0e625692 d167071b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -701,6 +701,15 @@ extern uint my_thread_end_wait_time;
  Keep track of shutdown,signal, and main threads so that my_end() will not
  report errors with them
*/

/* Which kind of thread library is in use */

#define THD_LIB_OTHER 1
#define THD_LIB_NPTL  2
#define THD_LIB_LT    4

extern uint thd_lib_detected;

	/* statistics_xxx functions are for not essential statistic */

#ifndef thread_safe_increment
+3 −5
Original line number Diff line number Diff line
@@ -24,11 +24,6 @@ extern "C" {
#ifndef USE_ALARM_THREAD
#define USE_ONE_SIGNAL_HAND		/* One must call process_alarm */
#endif
#ifdef HAVE_LINUXTHREADS
#define THR_CLIENT_ALARM SIGALRM
#else
#define THR_CLIENT_ALARM SIGUSR1
#endif
#ifdef HAVE_rts_threads
#undef USE_ONE_SIGNAL_HAND
#define USE_ALARM_THREAD
@@ -90,6 +85,9 @@ typedef struct st_alarm {
  my_bool malloced;
} ALARM;

extern uint thr_client_alarm;
extern pthread_t alarm_thread;

#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm);
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ fi

###########################################################################

client_args="--silent --socket=$socket_path --connect_timeout=1 "
client_args="--no-defaults --silent --socket=$socket_path --connect_timeout=1 "

[ -n "$username" ] && client_args="$client_args --user=$username "
[ -n "$password" ] && client_args="$client_args --password=$password "
+5 −5
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@

uint thd_lib_detected= 0;

uint thd_lib_detected;

#ifndef my_pthread_setprio
void my_pthread_setprio(pthread_t thread_id,int prior)
{
@@ -51,8 +53,6 @@ int my_pthread_getprio(pthread_t thread_id)
  int policy;
  if (!pthread_getschedparam(thread_id,&policy,&tmp_sched_param))
  {
    DBUG_PRINT("thread",("policy: %d  priority: %d",
			 policy,tmp_sched_param.sched_priority));
    return tmp_sched_param.sched_priority;
  }
#endif
@@ -314,8 +314,6 @@ void sigwait_handle_sig(int sig)
  pthread_mutex_unlock(&LOCK_sigwait);
}

extern pthread_t alarm_thread;

void *sigwait_thread(void *set_arg)
{
  sigset_t *set=(sigset_t*) set_arg;
@@ -334,7 +332,9 @@ void *sigwait_thread(void *set_arg)
      sigaction(i, &sact, (struct sigaction*) 0);
    }
  }
  sigaddset(set,THR_CLIENT_ALARM);
  /* Ensure that init_thr_alarm() is called */
  DBUG_ASSERT(thr_client_alarm);
  sigaddset(set, thr_client_alarm);
  pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0);
  alarm_thread=pthread_self();			/* For thr_alarm */

+21 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include "mysys_priv.h"
#include <m_string.h>
#include <signal.h>

#ifdef THREAD
#ifdef USE_TLS
@@ -63,6 +64,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))
#endif


static uint get_thread_lib(void);

/*
  initialize thread environment

@@ -76,6 +79,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))

my_bool my_thread_global_init(void)
{
  thd_lib_detected= get_thread_lib();

  if (pthread_key_create(&THR_KEY_mysys,0))
  {
    fprintf(stderr,"Can't initialize threads: error %d\n",errno);
@@ -395,4 +400,20 @@ const char *my_thread_name(void)
}
#endif /* DBUG_OFF */


static uint get_thread_lib(void)
{
#ifdef _CS_GNU_LIBPTHREAD_VERSION
  char buff[64];
    
  confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff));

  if (!strncasecmp(buff, "NPTL", 4))
    return THD_LIB_NPTL;
  if (!strncasecmp(buff, "linuxthreads", 12))
    return THD_LIB_LT;
#endif
  return THD_LIB_OTHER;
}

#endif /* THREAD */
Loading