X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3cdd0ac83adfa4f28b05b4c1961555e5203bc6a8..0c13871d73e933c1847faf8debea7b7745a3ff44:/src/xbt/xbt_os_thread.c diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index 2e9e91f910..05924d2217 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -8,7 +8,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_config.h" +#include "internal_config.h" #include "xbt/sysdep.h" #include "xbt/ex.h" #include "xbt/ex_interface.h" /* We play crude games with exceptions */ @@ -194,8 +194,17 @@ xbt_os_thread_t xbt_os_thread_create(const char *name, void xbt_os_thread_setstacksize(int stack_size) { + size_t def=0; + if(stack_size<0)xbt_die("stack size is negative, maybe it exceeds MAX_INT?\n"); pthread_attr_init(&attr); - pthread_attr_setstacksize (&attr, stack_size); + pthread_attr_getstacksize (&attr, &def); + int res = pthread_attr_setstacksize (&attr, stack_size); + if ( res!=0 ) { + if(res==EINVAL)XBT_WARN("Thread stack size is either < PTHREAD_STACK_MIN, > the max limit of the system, or perhaps not a multiple of PTHREAD_STACK_MIN - The parameter was ignored"); + else XBT_WARN("unknown error in pthread stacksize setting"); + + pthread_attr_setstacksize (&attr, def); + } thread_attr_inited=1; } @@ -722,9 +731,9 @@ xbt_os_thread_t xbt_os_thread_create(const char *name, return t; } -void xbt_os_thread_setstacksize(int stack_size) +void xbt_os_thread_setstacksize(int size) { - stack_size=stack_size; + stack_size = size; } const char *xbt_os_thread_name(xbt_os_thread_t t)