X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fefb1b181bf222289e0101d467dbc743299d7380..bc48db087894fd960073b3120cebf90e6b2f8c02:/src/xbt/xbt_os_thread.c diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index c697ae7bf4..b80fb3199a 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -9,7 +9,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/internal_config.h" -#ifdef HAVE_PTHREAD_SETAFFINITY +#if HAVE_PTHREAD_SETAFFINITY #define _GNU_SOURCE #include #endif @@ -25,7 +25,8 @@ #include #include -#if defined(WIN32) +#if defined(_WIN32) +#include #elif defined(__MACH__) && defined(__APPLE__) #include #include @@ -37,7 +38,7 @@ #include "xbt/sysdep.h" #include "xbt/ex.h" #include "src/xbt/ex_interface.h" /* We play crude games with exceptions */ -#include "src/portable.h" +#include "src/internal_config.h" #include "xbt/xbt_os_time.h" /* Portable time facilities */ #include "xbt/xbt_os_thread.h" /* This module */ #include "src/xbt_modinter.h" /* Initialization/finalization of this module */ @@ -46,7 +47,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt, "Synchronization mechanism (OS /* use named sempahore when sem_init() does not work */ -#ifndef HAVE_SEM_INIT +#if !HAVE_SEM_INIT static int next_sem_ID = 0; static xbt_os_mutex_t next_sem_ID_lock; #endif @@ -124,7 +125,7 @@ void xbt_os_thread_mod_preinit(void) thread_mod_inited = 1; -#ifndef HAVE_SEM_INIT +#if !HAVE_SEM_INIT next_sem_ID_lock = xbt_os_mutex_init(); #endif } @@ -141,7 +142,7 @@ void xbt_os_thread_mod_postexit(void) free(main_thread); main_thread = NULL; thread_mod_inited = 0; -#ifndef HAVE_SEM_INIT +#if !HAVE_SEM_INIT xbt_os_mutex_destroy(next_sem_ID_lock); #endif @@ -200,7 +201,7 @@ xbt_os_thread_t xbt_os_thread_create(const char *name, pvoid_f_pvoid_t start_ro */ int xbt_os_thread_bind(xbt_os_thread_t thread, int cpu){ int errcode = 0; -#ifdef HAVE_PTHREAD_SETAFFINITY +#if HAVE_PTHREAD_SETAFFINITY pthread_t pthread = thread->t; cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -254,11 +255,6 @@ void xbt_os_thread_setguardsize(int guard_size) #endif } -const char *xbt_os_thread_name(xbt_os_thread_t t) -{ - return t->name; -} - const char *xbt_os_thread_self_name(void) { xbt_os_thread_t me = xbt_os_thread_self(); @@ -404,7 +400,7 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond) } typedef struct xbt_os_sem_ { -#ifndef HAVE_SEM_INIT +#if !HAVE_SEM_INIT char *name; #endif sem_t s; @@ -423,7 +419,7 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value) * Any attempt to use it leads to ENOSYS (function not implemented). * If such a prehistoric system is detected, do the job with sem_open instead */ -#ifdef HAVE_SEM_INIT +#if HAVE_SEM_INIT if (sem_init(&(res->s), 0, value) != 0) THROWF(system_error, errno, "sem_init() failed: %s", strerror(errno)); res->ps = &(res->s); @@ -467,7 +463,7 @@ void xbt_os_sem_release(xbt_os_sem_t sem) void xbt_os_sem_destroy(xbt_os_sem_t sem) { -#ifdef HAVE_SEM_INIT +#if HAVE_SEM_INIT if (sem_destroy(sem->ps) < 0) THROWF(system_error, errno, "sem_destroy() failed: %s", strerror(errno));