From: Martin Quinson Date: Wed, 16 Jan 2019 07:44:31 +0000 (+0100) Subject: Kill xbt_os_thread_atfork: tesh is not native but python now X-Git-Tag: v3_22~547 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/df740d05eb82dc5c7af785e0967db186f9ea194c?hp=eafc74c43ab183dd245821f7984729a9e7eb4880;ds=sidebyside Kill xbt_os_thread_atfork: tesh is not native but python now --- diff --git a/include/xbt/xbt_os_thread.h b/include/xbt/xbt_os_thread.h index 95a3377adb..e21a5d1873 100644 --- a/include/xbt/xbt_os_thread.h +++ b/include/xbt/xbt_os_thread.h @@ -24,8 +24,6 @@ SG_BEGIN_DECL() * @{ */ -XBT_PUBLIC int xbt_os_thread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)); - /** @brief Thread mutex data type (opaque structure) */ typedef struct xbt_os_mutex_ *xbt_os_mutex_t; XBT_PUBLIC xbt_os_mutex_t xbt_os_mutex_init(void); diff --git a/src/xbt/mmalloc/mm_module.c b/src/xbt/mmalloc/mm_module.c index a2bfb2be0d..98a704111e 100644 --- a/src/xbt/mmalloc/mm_module.c +++ b/src/xbt/mmalloc/mm_module.c @@ -324,12 +324,6 @@ void *mmalloc_preinit(void) unsigned long mask = ~((unsigned long)xbt_pagesize - 1); void *addr = (void*)(((unsigned long)sbrk(0) + HEAP_OFFSET) & mask); __mmalloc_default_mdp = xbt_mheap_new_options(-1, addr, XBT_MHEAP_OPTION_MEMSET); - /* Fixme? only the default mdp in protected against forks */ - // This is mandated to protect the mmalloced areas through forks. Think of tesh. - // Nah, removing the mutex isn't a good idea either for tesh - int res = xbt_os_thread_atfork(mmalloc_fork_prepare, mmalloc_fork_parent, mmalloc_fork_child); - if (res != 0) - THROWF(system_error,0,"xbt_os_thread_atfork() failed: return value %d",res); } xbt_assert(__mmalloc_default_mdp != NULL); diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index 1a19ba5ac6..a89cf69057 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -43,25 +43,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt, "Synchronization mechanism (OS-level)"); -typedef struct xbt_os_thread_ { - pthread_t t; - void *param; - pvoid_f_pvoid_t start_routine; -} s_xbt_os_thread_t; - -/** Calls pthread_atfork() if present, and raise an exception otherwise. - * - * The only known user of this wrapper is mmalloc_preinit(), but it is absolutely mandatory there: - * when used with tesh, mmalloc *must* be mutex protected and resistant to forks. - * This functionality is the only way to get it working (by ensuring that the mutex is consistently released on forks) - */ - -/* this function is critical to tesh+mmalloc, don't mess with it */ -int xbt_os_thread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) -{ - return pthread_atfork(prepare, parent, child); -} - /****** mutex related functions ******/ typedef struct xbt_os_mutex_ { pthread_mutex_t m;