diff options
author | root <root> | 2009-04-22 11:04:49 +0000 |
---|---|---|
committer | root <root> | 2009-04-22 11:04:49 +0000 |
commit | 217dcba927bf9f2ca731fdd9088b3d542d3035b7 (patch) | |
tree | fa18eefdfe22d77a9ab7f46ee0488299f6c9ebd1 | |
parent | 44c5e91d7894677422bcfe27f68147d8a3353154 (diff) |
*** empty log message ***
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | eio.c | 4 | ||||
-rw-r--r-- | eio.pod | 21 | ||||
-rw-r--r-- | xthread.h | 11 |
4 files changed, 35 insertions, 2 deletions
@@ -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. @@ -38,6 +38,10 @@ */ #include "eio.h" + +#ifdef EIO_STACKSIZE +# define XTHREAD_STACKSIZE EIO_STACKSIZE +#endif #include "xthread.h" #include <errno.h> @@ -245,6 +245,27 @@ If you need to know how, check the C<IO::AIO> perl module, which does exactly that. +=head1 COMPILETIME CONFIGURATION + +These symbols, if used, must be defined when compiling F<eio.c>. + +=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<EIO_CUSTOM> +requests, you might want to increase this. + +If this symbol is undefined (the default) then libeio will use its default +stack size (C<sizeof (long) * 4096> 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 @@ -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 - ? sizeof (long) * 4096 : 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 |