Skip to content
Browse files

get stacksize from mysql variable if not available from thread info o…

…n OS

*	modified:   Makefile.am
*	modified:   Makefile.in
*	modified:   preg.c
  • Loading branch information...
1 parent 9276576 commit 54777e88ce178c99ee88fcb5318766103a23bab9 raw committed
Showing with 19 additions and 6 deletions.
  1. +2 −1 Makefile.am
  2. +2 −1 Makefile.in
  3. +15 −4 preg.c
View
3 Makefile.am
@@ -33,7 +33,8 @@ SUBDIRS=test doc
DIFFPROGRAM:=kompare -
lib_mysqludf_preg_la_CFLAGS = -DSTANDARD -DMYSQL_SERVER @MYSQL_CFLAGS@ @MYSQL_HEADERS@ @PCRE_CFLAGS@ @GHMYSQL_CFLAGS@ @PTHREAD_CFLAGS@
-lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@
+#lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@
+lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version @PCRE_LIBS@ @PTHREAD_LIBS@
EXTRA_DIST = *.sql
View
3 Makefile.in
@@ -405,7 +405,8 @@ DLL_OBJS = $(CFILES:%.c=.libs/lib_mysqludf_preg_la-%.o)
SUBDIRS = test doc
DIFFPROGRAM := kompare -
lib_mysqludf_preg_la_CFLAGS = -DSTANDARD -DMYSQL_SERVER @MYSQL_CFLAGS@ @MYSQL_HEADERS@ @PCRE_CFLAGS@ @GHMYSQL_CFLAGS@ @PTHREAD_CFLAGS@
-lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@
+#lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@
+lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version @PCRE_LIBS@ @PTHREAD_LIBS@
EXTRA_DIST = *.sql
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
View
19 preg.c
@@ -587,13 +587,24 @@ void pregSetLimits(pcre_extra *extra)
thread_stack_avail = 0 ;
#endif
- if (thread_stack_avail == 0) {
- // Checks failed, assume the MySQL defaults (64/32 bit)
+ if (thread_stack_avail == 0)
+ {
+ // Checks failed or OS (ie OSX) doesn't support getting current thread stack size
+ // Use information from mysqld global variable
+ //
+ extern unsigned long my_thread_stack_size;
+ thread_stack_size = my_thread_stack_size ;
+
+ if( !thread_stack_size ) {
+ // Checks failed, assume the MySQL defaults (64/32 bit)
+ // Shouldn't ever really get here, though.
+ ghlogprintf( "Ignoring mysqld:thread_stack. Using mysql defaults.") ;
#ifdef _LP64
- thread_stack_size = 256*1024;
+ thread_stack_size = 256*1024;
#else
- thread_stack_size = 192*1024;
+ thread_stack_size = 192*1024;
#endif
+ }
// And assume a current usage of 25% (_wild_ guess!)
thread_stack_avail = thread_stack_size*0.75;
}

0 comments on commit 54777e8

Please sign in to comment.
Something went wrong with that request. Please try again.