diff options
author | Vladislav Vaintroub <vvaintroub@mysql.com> | 2009-12-19 14:11:48 +0100 |
---|---|---|
committer | Vladislav Vaintroub <vvaintroub@mysql.com> | 2009-12-19 14:11:48 +0100 |
commit | 3de04825514e4dc3fd6f1a8f5eb18a280f817699 (patch) | |
tree | d5461ec6ad35812385dd5cfef327052838c471b4 /include | |
parent | 4f233c43b11b6f4f159350a192fa3fb3e3ce6c9a (diff) | |
parent | 02b76970c5da2b836d322e4189cdde79a5c15f4c (diff) | |
download | mariadb-git-3de04825514e4dc3fd6f1a8f5eb18a280f817699.tar.gz |
merge
Diffstat (limited to 'include')
-rw-r--r-- | include/atomic/nolock.h | 32 | ||||
-rw-r--r-- | include/atomic/solaris.h | 2 | ||||
-rw-r--r-- | include/my_global.h | 2 | ||||
-rw-r--r-- | include/my_no_pthread.h | 8 | ||||
-rw-r--r-- | include/my_pthread.h | 10 | ||||
-rw-r--r-- | include/my_stacktrace.h | 2 | ||||
-rw-r--r-- | include/my_sys.h | 1 | ||||
-rw-r--r-- | include/myisam.h | 3 |
8 files changed, 47 insertions, 13 deletions
diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h index e4cd9ab9896..9ec5eb5a2fd 100644 --- a/include/atomic/nolock.h +++ b/include/atomic/nolock.h @@ -17,23 +17,37 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \ - || defined(HAVE_GCC_ATOMIC_BUILTINS) + || defined(HAVE_GCC_ATOMIC_BUILTINS) \ + || defined(HAVE_SOLARIS_ATOMIC) # ifdef MY_ATOMIC_MODE_DUMMY # define LOCK_prefix "" # else # define LOCK_prefix "lock" # endif - -# ifdef HAVE_GCC_ATOMIC_BUILTINS -# include "gcc_builtins.h" -# elif __GNUC__ -# include "x86-gcc.h" -# elif defined(_MSC_VER) +/* + We choose implementation as follows: + ------------------------------------ + On Windows using Visual C++ the native implementation should be + preferrable. When using gcc we prefer the native x86 implementation, + we prefer the Solaris implementation before the gcc because of + stability preference, we choose gcc implementation if nothing else + works on gcc. If neither Visual C++ or gcc we still choose the + Solaris implementation on Solaris (mainly for SunStudio compiles. +*/ +# if defined(_MSV_VER) # include "generic-msvc.h" +# elif __GNUC__ +# if defined(__i386__) || defined(__x86_64__) +# include "x86-gcc.h" +# elif defined(HAVE_SOLARIS_ATOMIC) +# include "solaris.h" +# elif defined(HAVE_GCC_ATOMIC_BUILTINS) +# include "gcc_builtins.h" +# endif +# elif defined(HAVE_SOLARIS_ATOMIC) +# include "solaris.h" # endif -#elif defined(HAVE_SOLARIS_ATOMIC) -#include "solaris.h" #endif #if defined(make_atomic_cas_body) || defined(MY_ATOMICS_MADE) diff --git a/include/atomic/solaris.h b/include/atomic/solaris.h index f8845a16bae..34c0c6de0ed 100644 --- a/include/atomic/solaris.h +++ b/include/atomic/solaris.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008 MySQL AB +/* Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/include/my_global.h b/include/my_global.h index 9898d060e8a..e0a6d79a54b 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -979,7 +979,7 @@ inline unsigned long long my_double2ulonglong(double d) #define FLT_MAX ((float)3.40282346638528860e+38) #endif #ifndef SIZE_T_MAX -#define SIZE_T_MAX ~((size_t) 0) +#define SIZE_T_MAX (~((size_t) 0)) #endif #ifndef isfinite diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h index 995fc5e1774..a805a9151f8 100644 --- a/include/my_no_pthread.h +++ b/include/my_no_pthread.h @@ -59,5 +59,13 @@ #define mysql_rwlock_unlock(A) do {} while (0) #define mysql_rwlock_destroy(A) do {} while (0) +typedef int my_pthread_once_t; +#define MY_PTHREAD_ONCE_INIT 0 +#define MY_PTHREAD_ONCE_DONE 1 + +#define my_pthread_once(C,F) do { \ + if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \ + } while(0) + #endif #endif /* MY_NO_PTHREAD_INCLUDED */ diff --git a/include/my_pthread.h b/include/my_pthread.h index 51dd9c72c79..aa667e9ce72 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -67,6 +67,11 @@ typedef int pthread_mutexattr_t; #define pthread_handler_t EXTERNC void * __cdecl typedef void * (__cdecl *pthread_handler)(void *); +typedef volatile LONG my_pthread_once_t; +#define MY_PTHREAD_ONCE_INIT 0 +#define MY_PTHREAD_ONCE_INPROGRESS 1 +#define MY_PTHREAD_ONCE_DONE 2 + /* Struct and macros to be used in combination with the windows implementation of pthread_cond_timedwait @@ -110,6 +115,7 @@ int pthread_cond_destroy(pthread_cond_t *cond); int pthread_attr_init(pthread_attr_t *connect_att); int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack); int pthread_attr_destroy(pthread_attr_t *connect_att); +int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void)); struct tm *localtime_r(const time_t *timep,struct tm *tmp); struct tm *gmtime_r(const time_t *timep,struct tm *tmp); @@ -187,6 +193,10 @@ void my_pthread_exit(void *status); #define pthread_handler_t EXTERNC void * typedef void *(* pthread_handler)(void *); +#define my_pthread_once_t pthread_once_t +#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT +#define my_pthread_once(C,F) pthread_once(C,F) + /* Test first for RTS or FSU threads */ #if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index e7ce42c1f4f..df384b1c566 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -23,7 +23,7 @@ (defined(__alpha__) && defined(__GNUC__)) #define HAVE_STACKTRACE 1 #endif -#elif defined(__WIN__) +#elif defined(__WIN__) || defined(__sun) #define HAVE_STACKTRACE 1 #endif diff --git a/include/my_sys.h b/include/my_sys.h index 12ff5a329f7..645463714d1 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -982,7 +982,6 @@ extern my_bool resolve_collation(const char *cl_name, CHARSET_INFO *default_cl, CHARSET_INFO **cl); -extern void free_charsets(void); extern char *get_charsets_dir(char *buf); extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2); extern my_bool init_compiled_charsets(myf flags); diff --git a/include/myisam.h b/include/myisam.h index 194f0dd806a..e9d1e4ab43e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -259,6 +259,8 @@ extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size; /* usually used to check if a symlink points into the mysql data home */ /* which is normally forbidden */ extern int (*myisam_test_invalid_symlink)(const char *filename); +extern ulonglong myisam_mmap_size, myisam_mmap_used; +extern pthread_mutex_t THR_LOCK_myisam_mmap; /* Prototypes for myisam-functions */ @@ -304,6 +306,7 @@ extern int mi_delete_all_rows(struct st_myisam_info *info); extern ulong _mi_calc_blob_length(uint length , const uchar *pos); extern uint mi_get_pointer_length(ulonglong file_length, uint def); +#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */ /* this is used to pass to mysql_myisamchk_table */ #define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */ |