git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3231
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
THROW0(system_error,errcode,"pthread_key_create failed for xbt_self_thread_key");
}
void xbt_thread_mod_exit(void) {
THROW0(system_error,errcode,"pthread_key_create failed for xbt_self_thread_key");
}
void xbt_thread_mod_exit(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;
- if ((errcode=pthread_key_delete(xbt_self_thread_key)))
- THROW0(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key");
+// if ((errcode=pthread_key_delete(xbt_self_thread_key)))
+// THROW0(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key");
void xbt_mutex_destroy(xbt_mutex_t mutex) {
int errcode;
void xbt_mutex_destroy(xbt_mutex_t mutex) {
int errcode;
if ((errcode=pthread_mutex_destroy(&(mutex->m))))
THROW1(system_error,errcode,"pthread_mutex_destroy(%p) failed",mutex);
free(mutex);
if ((errcode=pthread_mutex_destroy(&(mutex->m))))
THROW1(system_error,errcode,"pthread_mutex_destroy(%p) failed",mutex);
free(mutex);
}
void xbt_thcond_destroy(xbt_thcond_t cond){
int errcode;
}
void xbt_thcond_destroy(xbt_thcond_t cond){
int errcode;
if ((errcode=pthread_cond_destroy(&(cond->c))))
THROW1(system_error,errcode,"pthread_cond_destroy(%p) failed",cond);
free(cond);
if ((errcode=pthread_cond_destroy(&(cond->c))))
THROW1(system_error,errcode,"pthread_cond_destroy(%p) failed",cond);
free(cond);
void xbt_mutex_destroy(xbt_mutex_t mutex) {
void xbt_mutex_destroy(xbt_mutex_t mutex) {
- DeleteCriticalSection(& mutex->lock);
-
+ if (!mutex) return;
+
+ DeleteCriticalSection(& mutex->lock);
void xbt_thcond_destroy(xbt_thcond_t cond){
int error = 0;
void xbt_thcond_destroy(xbt_thcond_t cond){
int error = 0;
if(!CloseHandle(cond->events[SIGNAL]))
error = 1;
if(!CloseHandle(cond->events[SIGNAL]))
error = 1;