Commit 21051b21 authored by vasil's avatar vasil

branches/zip:

Back-merge c5880 and c5881 from branches/embedded-1.0:

  ------------------------------------------------------------------------
  r5880 | vasil | 2009-09-12 17:28:44 +0300 (Sat, 12 Sep 2009) | 18 lines
  Changed paths:
     M /branches/embedded-1.0/configure.in
     M /branches/embedded-1.0/include/os0sync.h
     M /branches/embedded-1.0/srv/srv0start.c
  
  branches/embedded-1.0:
  
  Clean up and simplify the code that surrounds the atomic ops:
  
  * Simplify the code that prints what atomics are used:
  Instead of repeating the same conditions on which each atomics are used
  use just one printf that prints a variable defined by the code which
  chooses what atomics to use.
  
  * In os0sync.h pick up each atomic variant only if it has been selected
  by autoconf (based on IB_ATOMIC_MODE_* macros). Define the startup message
  to be printed.
  
  * In configure.in: check what user has chosen and if he has chosen
  something that is not available, emit an error. If nothing has been chosen
  explicitly by the user, auto select an option according to the described
  logic in configure.in.
  
  ------------------------------------------------------------------------
  r5881 | vasil | 2009-09-12 20:08:27 +0300 (Sat, 12 Sep 2009) | 4 lines
  Changed paths:
     M /branches/embedded-1.0/configure.in
  
  branches/embedded-1.0:
  
  Fix syntax error in test program.
  
  ------------------------------------------------------------------------
parent 824f2231
......@@ -285,7 +285,7 @@ os_fast_mutex_free(
/**********************************************************//**
Atomic compare-and-swap and increment for InnoDB. */
#ifdef HAVE_IB_GCC_ATOMIC_BUILTINS
#if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)
#define HAVE_ATOMIC_BUILTINS
......@@ -306,6 +306,11 @@ compare to, new_val is the value to swap in. */
# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
os_compare_and_swap(ptr, old_val, new_val)
# define INNODB_RW_LOCKS_USE_ATOMICS
# define IB_ATOMICS_STARTUP_MSG \
"Mutexes and rw_locks use GCC atomic builtins"
# else /* HAVE_IB_ATOMIC_PTHREAD_T_GCC */
# define IB_ATOMICS_STARTUP_MSG \
"Mutexes use GCC atomic builtins, rw_locks do not"
# endif /* HAVE_IB_ATOMIC_PTHREAD_T_GCC */
/**********************************************************//**
......@@ -356,7 +361,12 @@ compare to, new_val is the value to swap in. */
# else
# error "SIZEOF_PTHREAD_T != 4 or 8"
# endif /* SIZEOF_PTHREAD_T CHECK */
# define INNODB_RW_LOCKS_USE_ATOMICS
# define INNODB_RW_LOCKS_USE_ATOMICS
# define IB_ATOMICS_STARTUP_MSG \
"Mutexes and rw_locks use Solaris atomic functions"
# else /* HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS */
# define IB_ATOMICS_STARTUP_MSG \
"Mutexes use Solaris atomic functions, rw_locks do not"
# endif /* HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS */
/**********************************************************//**
......@@ -401,6 +411,9 @@ compare to, new_val is the value to swap in. */
/* windows thread objects can always be passed to windows atomic functions */
# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
(InterlockedCompareExchange(ptr, new_val, old_val) == old_val)
# define INNODB_RW_LOCKS_USE_ATOMICS
# define IB_ATOMICS_STARTUP_MSG \
"Mutexes and rw_locks use Windows interlocked functions"
/**********************************************************//**
Returns the resulting value, ptr is pointer to target, amount is the
......@@ -420,6 +433,9 @@ clobbered */
# define os_atomic_test_and_set_byte(ptr, new_val) \
((byte) InterlockedExchange(ptr, new_val))
#else
# define IB_ATOMICS_STARTUP_MSG \
"Mutexes and rw_locks use InnoDB's own implementation"
#endif
#ifndef UNIV_NONINL
......
......@@ -176,7 +176,7 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
return(1);
}
}
],
[
AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
......
......@@ -1107,34 +1107,7 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: The InnoDB memory heap is disabled\n");
}
#ifdef HAVE_IB_GCC_ATOMIC_BUILTINS
# ifdef INNODB_RW_LOCKS_USE_ATOMICS
fprintf(stderr,
"InnoDB: Mutexes and rw_locks use GCC atomic builtins.\n");
# else /* INNODB_RW_LOCKS_USE_ATOMICS */
fprintf(stderr,
"InnoDB: Mutexes use GCC atomic builtins, rw_locks do not.\n");
# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#elif defined(HAVE_IB_SOLARIS_ATOMICS)
# ifdef INNODB_RW_LOCKS_USE_ATOMICS
fprintf(stderr,
"InnoDB: Mutexes and rw_locks use Solaris atomic functions.\n");
# else
fprintf(stderr,
"InnoDB: Mutexes use Solaris atomic functions.\n");
# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#elif HAVE_WINDOWS_ATOMICS
# ifdef INNODB_RW_LOCKS_USE_ATOMICS
fprintf(stderr,
"InnoDB: Mutexes and rw_locks use Windows interlocked functions.\n");
# else
fprintf(stderr,
"InnoDB: Mutexes use Windows interlocked functions.\n");
# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* HAVE_IB_GCC_ATOMIC_BUILTINS */
fprintf(stderr,
"InnoDB: Neither mutexes nor rw_locks use GCC atomic builtins.\n");
#endif /* HAVE_IB_GCC_ATOMIC_BUILTINS */
fprintf(stderr, "InnoDB: %s\n", IB_ATOMICS_STARTUP_MSG);
/* Since InnoDB does not currently clean up all its internal data
structures in MySQL Embedded Server Library server_end(), we
......
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