# include <valgrind/valgrind.h>
#endif
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix,
- "Context switching mechanism");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix, "Context switching mechanism");
char* smx_context_factory_name = NULL; /* factory name specified by --cfg=contexts/factory:value */
int smx_context_stack_size;
#else
XBT_ERROR(" (boost was disabled at compilation time on this machine -- check configure logs for details. Did you install the libboost-context-dev package?)");
#endif
- XBT_ERROR(" thread: slow portability layer using system threads (pthreads on UNIX, CreateThread() on windows)");
+ XBT_ERROR(" thread: slow portability layer using pthreads as provided by gcc");
xbt_die("Please use a valid factory.");
}
}
}
#ifdef HAVE_VALGRIND_VALGRIND_H
- unsigned int valgrind_stack_id =
- VALGRIND_STACK_REGISTER(stack, (char *)stack + smx_context_stack_size);
- memcpy((char *)stack + smx_context_usable_stack_size, &valgrind_stack_id,
- sizeof valgrind_stack_id);
+ unsigned int valgrind_stack_id = VALGRIND_STACK_REGISTER(stack, (char *)stack + smx_context_stack_size);
+ memcpy((char *)stack + smx_context_usable_stack_size, &valgrind_stack_id, sizeof valgrind_stack_id);
#endif
return stack;
#ifdef HAVE_VALGRIND_VALGRIND_H
unsigned int valgrind_stack_id;
- memcpy(&valgrind_stack_id, (char *)stack + smx_context_usable_stack_size,
- sizeof valgrind_stack_id);
+ memcpy(&valgrind_stack_id, (char *)stack + smx_context_usable_stack_size, sizeof valgrind_stack_id);
VALGRIND_STACK_DEREGISTER(valgrind_stack_id);
#endif
#ifndef _WIN32
if (smx_context_guard_size > 0 && !MC_is_active()) {
stack = (char *)stack - smx_context_guard_size;
- if (mprotect(stack, smx_context_guard_size,
- PROT_READ | PROT_WRITE) == -1) {
+ if (mprotect(stack, smx_context_guard_size, PROT_READ | PROT_WRITE) == -1) {
XBT_WARN("Failed to remove page protection: %s", strerror(errno));
/* try to pursue anyway */
}
stack = *((void **)stack - 1);
#endif
}
-#endif
+#endif /* not windows */
xbt_free(stack);
}
-/**
- * \brief Returns whether some parallel threads are used
- * for the user contexts.
- * \return 1 if parallelism is used
- */
+/** @brief Returns whether some parallel threads are used for the user contexts. */
int SIMIX_context_is_parallel(void) {
return smx_parallel_contexts > 1;
}
/* Warning: The file internal_config.h is AUTOMATICALLY GENERATED by Cmake.
* Edit the template instead: tools/cmake/src/internal_config.h.in */
-/* Copyright (c) 2004-2016. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2004-2016. The SimGrid Team. All rights reserved. */
/* 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. */
-/* If __thread is available */
-#cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@
-
-#ifndef __STRICT_ANSI__
- #cmakedefine __STRICT_ANSI__ @__STRICT_ANSI__@
-#endif
-#ifndef _MSC_VER
- #cmakedefine _MSC_VER @_MSC_VER@
-#endif
-#ifndef _M_IX86
- #cmakedefine _M_IX86 @_M_IX86@
-#endif
-#cmakedefine APPLE @APPLE@
-/* Set to true if enable_model-checking is true */
-#cmakedefine MMALLOC_WANT_OVERRIDE_LEGACY @MMALLOC_WANT_OVERRIDE_LEGACY@
-#cmakedefine HAVE_MC @HAVE_MC@
-
-/* If have linux_futex.h */
-#cmakedefine HAVE_FUTEX_H @HAVE_FUTEX_H@
-
-/* Some variable for graphviz */
-#cmakedefine HAVE_GRAPHVIZ @HAVE_GRAPHVIZ@
-#cmakedefine HAVE_GRAPH_H @GRAPH_H@
-#cmakedefine HAVE_CGRAPH_H @CGRAPH_H@
-#cmakedefine HAVE_AGRAPH_H @AGRAPH_H@
-
-/* Path to the addr2line tool */
-#cmakedefine ADDR2LINE "@ADDR2LINE@"
-
-/* Define if xbt contexts are based on our threads implementation or not */
-#cmakedefine HAVE_THREAD_CONTEXTS @HAVE_THREAD_CONTEXTS@
-
-/* Define to 1 if you have the <ucontext.h> header file. */
-#cmakedefine HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@
-
-/* Define if xbt contexts are based on ucontext or not */
+/* Non-standard header files */
+#cmakedefine HAVE_EXECINFO_H @HAVE_EXECINFO_H@ /* <execinfo.h> */
+#cmakedefine HAVE_FUTEX_H @HAVE_FUTEX_H@ /* <linux/futex.h> */
+#cmakedefine HAVE_SIGNAL_H @HAVE_SIGNAL_H@ /* <signal.h> */
+#cmakedefine HAVE_SYS_PTRACE_H @HAVE_SYS_PTRACE_H@ /* <sys/ptrace.h> */
+#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ /* <sys/types.h> */
+#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ /* <unistd.h> */
+#cmakedefine HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@ /* <ucontext.h> */
+#cmakedefine HAVE_VALGRIND_VALGRIND_H @HAVE_VALGRIND_VALGRIND_H@ /* <valgrind/valgrind.h> */
+
+/* Time portability */
+#cmakedefine HAVE_GETTIMEOFDAY @HAVE_GETTIMEOFDAY@ /* Function gettimeofday */
+#cmakedefine HAVE_POSIX_GETTIME @HAVE_POSIX_GETTIME@ /* Function clock_gettime */
+#cmakedefine HAVE_NANOSLEEP @HAVE_NANOSLEEP@ /* Function nanosleep */
+
+/* The usable context factories */
+#cmakedefine HAVE_BOOST_CONTEXTS @HAVE_BOOST_CONTEXTS@
+#cmakedefine HAVE_RAW_CONTEXTS @HAVE_RAW_CONTEXTS@
+#cmakedefine HAVE_THREAD_CONTEXTS @HAVE_THREAD_CONTEXTS@
#cmakedefine HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@
-/* Used to select the flavor of assembly that we need today */
+/* Variables for the thread contexts (and parallel mode of raw contexts) */
+#cmakedefine HAVE_PTHREAD @HAVE_PTHREAD@ /* Define to 1 if threads are usable . */
+#cmakedefine HAVE_PTHREAD_SETAFFINITY @HAVE_PTHREAD_SETAFFINITY@ /* Does not seems defined on Mac nor Windows */
+#cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@ /* If __thread is available */
+
+/* Variables for the raw contexts (to select the right assembly code) */
#cmakedefine PROCESSOR_i686 @PROCESSOR_i686@
#cmakedefine PROCESSOR_x86_64 @PROCESSOR_x86_64@
#cmakedefine CMAKE_SYSTEM_PROCESSOR @CMAKE_SYSTEM_PROCESSOR@
-#cmakedefine HAVE_RAW_CONTEXTS @HAVE_RAW_CONTEXTS@
-#cmakedefine HAVE_BOOST_CONTEXTS @HAVE_BOOST_CONTEXTS@
-
-/* Define to 1 if you have the <execinfo.h> header file. */
-#cmakedefine HAVE_EXECINFO_H @HAVE_EXECINFO_H@
-
-/* Define to 1 if mmalloc is compiled in. */
-#cmakedefine HAVE_MMALLOC @HAVE_MMALLOC@
-
-/* Define to 1 if mmap is available */
-#cmakedefine HAVE_MMAP @HAVE_MMAP@
-
-/* Define to 1 if process_vm_readv is available */
-#cmakedefine HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@
-
-/* Define to 1 if you have the `getdtablesize' function. */
-#cmakedefine HAVE_GETDTABLESIZE @HAVE_GETDTABLESIZE@
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#cmakedefine HAVE_GETTIMEOFDAY @HAVE_GETTIMEOFDAY@
-/* Define to 1 if you have the `clock_gettime' function. */
-#cmakedefine HAVE_POSIX_GETTIME @HAVE_POSIX_GETTIME@
-
-/* Indicates that we have SMPI support */
-#cmakedefine HAVE_SMPI @HAVE_SMPI@
-
-/* Indicates that we have SMPI FORTRAN support */
-#cmakedefine SMPI_FORTRAN @SMPI_FORTRAN@
-
-/* We have mmap and objdump to handle privatization */
-#cmakedefine HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@
-
-#cmakedefine HAVE_PTHREAD @HAVE_PTHREAD@ /* Define to 1 if threads are usable . */
-#cmakedefine HAVE_PTHREAD_SETAFFINITY @HAVE_PTHREAD_SETAFFINITY@ /* Seems to be linux only */
-
-/* Define to 1 if you have the `popen' function. */
-#cmakedefine HAVE_POPEN @HAVE_POPEN@
-
-/* Define if sem_init() is avaible or not (part of XPG6 standard only) */
-#cmakedefine HAVE_SEM_INIT @HAVE_SEM_INIT@
-
-/* Define to 1 if you have the <signal.h> header file. */
-#cmakedefine HAVE_SIGNAL_H @HAVE_SIGNAL_H@
-
-/* Define to 1 if you have the `sysconf' function. */
-#cmakedefine HAVE_SYSCONF @HAVE_SYSCONF@
-
-/* Define to 1 if you have the <sys/ptrace.h> header file. */
-#cmakedefine HAVE_SYS_PTRACE_H @HAVE_SYS_PTRACE_H@
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@
-
-/* Define to 1 if you have the `nanosleep' function. */
-#cmakedefine HAVE_NANOSLEEP @HAVE_NANOSLEEP@
-
-/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
-#cmakedefine HAVE_VALGRIND_VALGRIND_H @HAVE_VALGRIND_VALGRIND_H@
-
-#cmakedefine HAVE_VASPRINTF @HAVE_VASPRINTF@
+/* MC variables */
+#cmakedefine HAVE_GETDTABLESIZE @HAVE_GETDTABLESIZE@ /* getdtablesize: get descriptor table size */
+#cmakedefine HAVE_MMALLOC @HAVE_MMALLOC@ /* Did we compile mmalloc in? */
+#cmakedefine HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@ /* process_vm_readv: transfer data between process address spaces */
+#cmakedefine MMALLOC_WANT_OVERRIDE_LEGACY @MMALLOC_WANT_OVERRIDE_LEGACY@ /* Set to true if enable_model-checking is true */
+#cmakedefine HAVE_MC @HAVE_MC@
-/* define for stack growth */
-#cmakedefine PTH_STACKGROWTH @PTH_STACKGROWTH@
+/* SMPI variables */
+#cmakedefine HAVE_SMPI @HAVE_SMPI@
+#cmakedefine SMPI_FORTRAN @SMPI_FORTRAN@
+#cmakedefine HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
-/* Define to 1 if you have the ANSI C header files. */
-#cmakedefine STDC_HEADERS @STDC_HEADERS@
+/* graphviz variables */
+#cmakedefine HAVE_GRAPHVIZ @HAVE_GRAPHVIZ@
+#cmakedefine HAVE_GRAPH_H @GRAPH_H@
+#cmakedefine HAVE_CGRAPH_H @CGRAPH_H@
+#cmakedefine HAVE_AGRAPH_H @AGRAPH_H@
-/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */
-#cmakedefine YYTEXT_POINTER
+/* Other function checks */
+#cmakedefine HAVE_MMAP @HAVE_MMAP@ /* Function mmap */
+#cmakedefine HAVE_SEM_INIT @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
+#cmakedefine HAVE_POPEN @HAVE_POPEN@ /* Function popen */
+#cmakedefine HAVE_SYSCONF @HAVE_SYSCONF@ /* Function sysconf */
+#cmakedefine HAVE_VASPRINTF @HAVE_VASPRINTF@ /* Function vasprintf */
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#cmakedefine size_t @size_t@
+/* Other checks */
+#cmakedefine PTH_STACKGROWTH @PTH_STACKGROWTH@ /* Does the stack growth upward, or downward? */
+#cmakedefine ADDR2LINE "@ADDR2LINE@" /* Path to the addr2line tool */