Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define the right type for xbt_os_thread_key_t
authorChristophe Thiéry <christopho128@gmail.com>
Fri, 22 Apr 2011 15:19:13 +0000 (17:19 +0200)
committerChristophe Thiéry <christopho128@gmail.com>
Fri, 22 Apr 2011 15:19:13 +0000 (17:19 +0200)
src/include/xbt/xbt_os_thread.h
src/xbt/xbt_os_thread.c

index 22d56bb..870af9b 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef _XBT_OS_THREAD_H
 #define _XBT_OS_THREAD_H
 
+#include "gras_config.h"
 #include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/function_types.h"
 
@@ -26,7 +27,12 @@ SG_BEGIN_DECL()
   /** \brief Thread data type (opaque structure) */
 typedef struct xbt_os_thread_ *xbt_os_thread_t;
 
-typedef unsigned int xbt_os_thread_key_t;
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+typedef pthread_key_t xbt_os_thread_key_t;
+#elif defined(_XBT_WIN32)
+typedef DWORD xbt_os_thread_key_t;
+#endif
 
 /* Calls pthread_atfork() if present, and else does nothing.
  * The only known user of this wrapper is mmalloc_preinit().
index 7d58f3e..e8c86e3 100644 (file)
@@ -23,7 +23,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt,
 /* ********************************* PTHREAD IMPLEMENTATION ************************************ */
 #ifdef HAVE_PTHREAD_H
 
-#include <pthread.h>
 #include <semaphore.h>
 
 #ifdef HAVE_MUTEX_TIMEDLOCK