X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dff9e15c44ab6340d27215957c56fa72fad246a2..5d1ee7face499527e065d2425b6efced376906c0:/src/xbt/xbt_os_thread.c diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index f827c4a52e..8b99b2770c 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -1,11 +1,9 @@ -/* $Id$ */ - /* xbt_os_thread -- portability layer over the pthread API */ /* Used in RL to get win/lin portability, and in SG when CONTEXT_THREAD */ /* in SG, when using CONTEXT_UCONTEXT, xbt_os_thread_stub is used instead */ -/* Copyright 2006,2007 Malek Cherier, Martin Quinson - * All right reserved. */ +/* Copyright (c) 2007, 2008, 2009, 2010. 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. */ @@ -74,7 +72,7 @@ static void _os_thread_ex_terminate(xbt_ex_t * e) /* FIXME: there should be a configuration variable to choose to kill everyone or only this one */ } -void xbt_os_thread_mod_init(void) +void xbt_os_thread_mod_preinit(void) { int errcode; @@ -103,8 +101,7 @@ void xbt_os_thread_mod_init(void) } -void xbt_os_thread_mod_exit(void) -{ +void xbt_os_thread_mod_postexit(void) { /* FIXME: don't try to free our key on shutdown. Valgrind detects no leak if we don't, and whine if we try to */ // int errcode; @@ -118,6 +115,10 @@ void xbt_os_thread_mod_exit(void) #ifndef HAVE_SEM_WAIT xbt_os_mutex_destroy(next_sem_ID_lock); #endif + + /* Restore the default exception setup */ + __xbt_ex_ctx = &__xbt_ex_ctx_default; + __xbt_ex_terminate = &__xbt_ex_terminate_default; } static void *wrapper_start_routine(void *s) @@ -575,7 +576,7 @@ void xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue) /* ********************************* WINDOWS IMPLEMENTATION ************************************ */ -#elif defined(WIN32) +#elif defined(_XBT_WIN32) #include @@ -598,12 +599,12 @@ typedef struct xbt_os_thread_ { /* key to the TLS containing the xbt_os_thread_t structure */ static unsigned long xbt_self_thread_key; -void xbt_os_thread_mod_init(void) +void xbt_os_thread_mod_preinit(void) { xbt_self_thread_key = TlsAlloc(); } -void xbt_os_thread_mod_exit(void) +void xbt_os_thread_mod_postexit(void) { if (!TlsFree(xbt_self_thread_key))