diff --git a/deps/libeio/Changes b/deps/libeio/Changes index d98deefdd0..d4c3a12a7a 100644 --- a/deps/libeio/Changes +++ b/deps/libeio/Changes @@ -3,6 +3,7 @@ Revision history for libeio TODO: maybe add mincore support? available on at leats darwin, solaris, linux, freebsd 1.0 + - added EIO_STACKSIZE. - added msync, mtouch support (untested). - added sync_file_range (untested). - fixed custom support. diff --git a/deps/libeio/eio.c b/deps/libeio/eio.c index e0e172fbf4..b26008b140 100644 --- a/deps/libeio/eio.c +++ b/deps/libeio/eio.c @@ -38,6 +38,10 @@ */ #include "eio.h" + +#ifdef EIO_STACKSIZE +# define XTHREAD_STACKSIZE EIO_STACKSIZE +#endif #include "xthread.h" #include diff --git a/deps/libeio/eio.pod b/deps/libeio/eio.pod index bbacb662d3..d16b3a9a4f 100644 --- a/deps/libeio/eio.pod +++ b/deps/libeio/eio.pod @@ -245,6 +245,27 @@ If you need to know how, check the C perl module, which does exactly that. +=head1 COMPILETIME CONFIGURATION + +These symbols, if used, must be defined when compiling F. + +=over 4 + +=item EIO_STACKSIZE + +This symbol governs the stack size for each eio thread. Libeio itself +was written to use very little stackspace, but when using C +requests, you might want to increase this. + +If this symbol is undefined (the default) then libeio will use its default +stack size (C currently). If it is defined, but +C<0>, then the default operating system stack size will be used. In all +other cases, the value must be an expression that evaluates to the desired +stack size. + +=back + + =head1 PORTABILITY REQUIREMENTS In addition to a working ISO-C implementation, libeio relies on a few diff --git a/deps/libeio/xthread.h b/deps/libeio/xthread.h index 63ff20cbd4..88881e8a97 100644 --- a/deps/libeio/xthread.h +++ b/deps/libeio/xthread.h @@ -118,6 +118,10 @@ typedef pthread_t thread_t; # define PTHREAD_STACK_MIN 0 #endif +#ifndef XTHREAD_STACKSIZE +# define XTHREAD_STACKSIZE sizeof (long) * 4096 +#endif + static int thread_create (thread_t *tid, void *(*proc)(void *), void *arg) { @@ -127,8 +131,11 @@ thread_create (thread_t *tid, void *(*proc)(void *), void *arg) pthread_attr_init (&attr); pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN < sizeof (long) * 4096 * 4 - ? sizeof (long) * 4096 * 4 : PTHREAD_STACK_MIN); + + if (XTHREAD_STACKSIZE > 0) + pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN > (XTHREAD_STACKSIZE) + ? PTHREAD_STACK_MIN : (XTHREAD_STACKSIZE)); + #ifdef PTHREAD_SCOPE_PROCESS pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS); #endif diff --git a/wscript b/wscript index 15e55b7a94..fee5bd61ca 100644 --- a/wscript +++ b/wscript @@ -49,6 +49,7 @@ def configure(conf): conf.define("HAVE_GNUTLS", 1) conf.define("HAVE_CONFIG_H", 1) + conf.env.append_value("CCFLAGS", "-DEIO_STACKSIZE=%d" % (4096*8)) # Split off debug variant before adding variant specific defines debug_env = conf.env.copy() @@ -63,8 +64,8 @@ def configure(conf): # Configure default variant conf.setenv('default') - conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-O0', '-g']) - conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-O0', '-g']) + conf.env.append_value('CCFLAGS', ['-DDEBUG', '-O0', '-g']) + conf.env.append_value('CXXFLAGS', ['-DDEBUG', '-O0', '-g']) conf.write_config_header("config.h") def build(bld): @@ -77,18 +78,18 @@ def build(bld): deps_tgt = join(bld.srcnode.abspath(bld.env),"deps") v8dir_src = join(deps_src,"v8") v8dir_tgt = join(deps_tgt, "v8") - #v8lib = bld.env["staticlib_PATTERN"] % "v8_g" - v8lib = bld.env["staticlib_PATTERN"] % "v8" + v8lib = bld.env["staticlib_PATTERN"] % "v8_g" + #v8lib = bld.env["staticlib_PATTERN"] % "v8" v8 = bld.new_task_gen( target=join("deps/v8",v8lib), - #rule='cp -rf %s %s && cd %s && scons -Q mode=debug library=static snapshot=on' - rule='cp -rf %s %s && cd %s && scons -Q library=static snapshot=on' + rule='cp -rf %s %s && cd %s && scons -Q mode=debug library=static snapshot=on' + #rule='cp -rf %s %s && cd %s && scons -Q library=static snapshot=on' % ( v8dir_src , deps_tgt , v8dir_tgt), before="cxx" ) bld.env["CPPPATH_V8"] = "deps/v8/include" - bld.env["STATICLIB_V8"] = "v8" - #bld.env["STATICLIB_V8"] = "v8_g" + #bld.env["STATICLIB_V8"] = "v8" + bld.env["STATICLIB_V8"] = "v8_g" bld.env["LIBPATH_V8"] = v8dir_tgt bld.env["LINKFLAGS_V8"] = "-pthread"