Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
avoid setting the value of the stack size for thread factory if the parameter is...
authorAugustin Degomme <degomme@idpann.imag.fr>
Mon, 12 Nov 2012 13:33:50 +0000 (14:33 +0100)
committerAugustin Degomme <degomme@idpann.imag.fr>
Mon, 12 Nov 2012 13:33:50 +0000 (14:33 +0100)
include/simgrid/simix.h
src/simix/smx_context.c
src/simix/smx_context_thread.c

index 121b2cc..e12eb21 100644 (file)
@@ -161,6 +161,7 @@ typedef void (*smx_ctx_factory_initializer_t)(smx_context_factory_t*);
 XBT_PUBLIC(smx_ctx_factory_initializer_t) smx_factory_initializer_to_use;
 extern char* smx_context_factory_name;
 extern int smx_context_stack_size;
+extern int smx_context_stack_size_was_set;
 
 #ifdef HAVE_THREAD_LOCAL_STORAGE
 extern __thread smx_context_t smx_current_context;
index 9e1a961..0ce478f 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix,
 char* smx_context_factory_name = NULL; /* factory name specified by --cfg=contexts/factory:value */
 smx_ctx_factory_initializer_t smx_factory_initializer_to_use = NULL;
 int smx_context_stack_size = 128 * 1024;
-
+int smx_context_stack_size_was_set = 0;
 #ifdef HAVE_THREAD_LOCAL_STORAGE
 static __thread smx_context_t smx_current_context_parallel;
 #else
index e29c655..98bc49e 100644 (file)
@@ -92,7 +92,7 @@ smx_ctx_thread_factory_create_context(xbt_main_func_t code, int argc,
   if (code) {
     context->begin = xbt_os_sem_init(0);
     context->end = xbt_os_sem_init(0);
-    xbt_os_thread_setstacksize(smx_context_stack_size);
+    if(smx_context_stack_size_was_set)xbt_os_thread_setstacksize(smx_context_stack_size);
 
     /* create and start the process */
     /* NOTE: The first argument to xbt_os_thread_create used to be the process *