Browse Source

src: move starpu thread related functions to new file src/common/thread.h

Nathalie Furmento 12 years ago
parent
commit
3ae62277c5

+ 1 - 1
mpi/src/starpu_mpi_private.h

@@ -23,7 +23,7 @@
 #include "starpu_mpi.h"
 #include "starpu_mpi_fxt.h"
 #include <common/list.h>
-#include <common/utils.h>
+#include <common/thread.h>
 #include <pthread.h>
 
 #ifdef __cplusplus

+ 1 - 1
mpi/tests/mpi_irecv_detached.c

@@ -16,7 +16,7 @@
  */
 
 #include <starpu_mpi.h>
-#include <common/utils.h>
+#include <common/thread.h>
 #include "helper.h"
 
 #ifdef STARPU_QUICK_CHECK

+ 1 - 1
mpi/tests/mpi_isend_detached.c

@@ -16,7 +16,7 @@
  */
 
 #include <starpu_mpi.h>
-#include <common/utils.h>
+#include <common/thread.h>
 #include <pthread.h>
 #include "helper.h"
 

+ 1 - 1
mpi/tests/mpi_probe.c

@@ -16,7 +16,7 @@
  */
 
 #include <starpu_mpi.h>
-#include <common/utils.h>
+#include <common/thread.h>
 #include "helper.h"
 
 #ifdef STARPU_QUICK_CHECK

+ 1 - 0
src/Makefile.am

@@ -101,6 +101,7 @@ noinst_HEADERS = 						\
 	common/starpu_spinlock.h				\
 	common/fxt.h						\
 	common/utils.h						\
+	common/thread.h						\
 	common/barrier.h					\
 	common/uthash.h						\
 	common/barrier_counter.h				\

+ 2 - 2
src/common/barrier.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -23,7 +23,7 @@
 #endif
 
 #include <pthread.h>
-#include <common/utils.h>
+#include <common/thread.h>
 
 struct _starpu_barrier
 {

+ 2 - 2
src/common/starpu_spinlock.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -20,8 +20,8 @@
 #include <errno.h>
 #include <stdint.h>
 #include <pthread.h>
-#include <common/utils.h>
 #include <common/config.h>
+#include <common/thread.h>
 
 struct _starpu_spinlock
 {

+ 403 - 0
src/common/thread.h

@@ -0,0 +1,403 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2010, 2012-2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#ifndef __COMMON_THREAD_H__
+#define __COMMON_THREAD_H__
+
+#include <starpu.h>
+#include <pthread.h>
+#ifdef STARPU_SIMGRID
+#include <xbt/synchro_core.h>
+#include <msg/msg.h>
+#endif
+
+#ifdef STARPU_SIMGRID
+typedef xbt_mutex_t _starpu_pthread_mutex_t;
+#else
+typedef pthread_mutex_t _starpu_pthread_mutex_t;
+#endif
+
+int _starpu_check_mutex_deadlock(_starpu_pthread_mutex_t *mutex);
+
+struct _starpu_pthread_args {
+	void *(*f)(void*);
+	void *arg;
+};
+
+int _starpu_simgrid_thread_start(int argc, char *argv[]);
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_CREATE_ON(name, thread, attr, routine, threadarg, where) do {\
+	struct _starpu_pthread_args *_args = malloc(sizeof(*_args));           \
+	xbt_dynar_t _hosts;                                                    \
+	_args->f = routine;                                                    \
+	_args->arg = threadarg;                                                \
+	_hosts = MSG_hosts_as_dynar();                                         \
+	MSG_process_create((name), _starpu_simgrid_thread_start, _args,        \
+			xbt_dynar_get_as(_hosts, (where), msg_host_t));        \
+	xbt_dynar_free(&_hosts);                                               \
+} while (0)
+#else
+#define _STARPU_PTHREAD_CREATE_ON(name, thread, attr, routine, arg, where) do {\
+	int p_ret = pthread_create((thread), (attr), (routine), (arg));	       \
+	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_create: %s\n",                          \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+	}                                                                      \
+} while (0)
+#endif
+#define _STARPU_PTHREAD_CREATE(name, thread, attr, routine, arg)               \
+	_STARPU_PTHREAD_CREATE_ON(name, thread, attr, routine, arg, 0)
+
+/*
+ * Encapsulation of the pthread_key_* functions.
+ */
+#ifdef STARPU_SIMGRID
+typedef int _starpu_pthread_key_t;
+int _starpu_pthread_key_create(_starpu_pthread_key_t *key);
+#define _STARPU_PTHREAD_KEY_CREATE(key, destr) _starpu_pthread_key_create(key)
+int _starpu_pthread_key_delete(_starpu_pthread_key_t key);
+#define _STARPU_PTHREAD_KEY_DELETE(key) _starpu_pthread_key_delete(key)
+int _starpu_pthread_setspecific(_starpu_pthread_key_t key, void *ptr);
+#define _STARPU_PTHREAD_SETSPECIFIC(key, ptr) _starpu_pthread_setspecific(key, ptr)
+void *_starpu_pthread_getspecific(_starpu_pthread_key_t key);
+#define _STARPU_PTHREAD_GETSPECIFIC(key) _starpu_pthread_getspecific(key)
+#else
+typedef pthread_key_t _starpu_pthread_key_t;
+#define _STARPU_PTHREAD_KEY_CREATE(key, destr) do {                            \
+	int p_ret = pthread_key_create((key), (destr));	                       \
+	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_key_create: %s\n",                      \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+	}                                                                      \
+} while (0)
+
+#define _STARPU_PTHREAD_KEY_DELETE(key) do {                                   \
+	int p_ret = pthread_key_delete((key));	                               \
+	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_key_delete: %s\n",                      \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+	}                                                                      \
+} while (0)
+
+#define _STARPU_PTHREAD_SETSPECIFIC(key, ptr) do {                             \
+	int p_ret = pthread_setspecific((key), (ptr));	                       \
+	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_setspecific: %s\n",                     \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+	};                                                                     \
+} while (0)
+
+#define _STARPU_PTHREAD_GETSPECIFIC(key) pthread_getspecific((key))
+#endif
+
+/*
+ * Encapsulation of the pthread_mutex_* functions.
+ */
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_MUTEX_INITIALIZER NULL
+#define _STARPU_PTHREAD_MUTEX_INIT(mutex, attr) do {                           \
+	(*mutex) = xbt_mutex_init();                                           \
+} while (0)
+#else
+#define _STARPU_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define _STARPU_PTHREAD_MUTEX_INIT(mutex, attr) do {                           \
+	int p_ret = pthread_mutex_init((mutex), (attr));                       \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_mutex_init: %s\n",                      \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_MUTEX_DESTROY(mutex) do {                              \
+	if (*mutex)                                                            \
+		xbt_mutex_destroy((*mutex));                                   \
+} while (0)
+#else
+#define _STARPU_PTHREAD_MUTEX_DESTROY(mutex) do {                              \
+	int p_ret = pthread_mutex_destroy(mutex);                              \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_mutex_destroy: %s\n",                   \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while(0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_MUTEX_LOCK(mutex) do {                                 \
+	if (!(*mutex)) _STARPU_PTHREAD_MUTEX_INIT((mutex), NULL);              \
+	xbt_mutex_acquire((*mutex));                                           \
+} while (0)
+#else
+#define _STARPU_PTHREAD_MUTEX_LOCK(mutex) do {                                 \
+	int p_ret = pthread_mutex_lock(mutex);                                 \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_mutex_lock: %s\n",                      \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_MUTEX_TRYLOCK(mutex) (xbt_mutex_acquire(*mutex), 0)
+#else
+#define _STARPU_PTHREAD_MUTEX_TRYLOCK(mutex) pthread_mutex_trylock(mutex)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_MUTEX_UNLOCK(mutex) do {                               \
+	xbt_mutex_release((*mutex));                                           \
+} while (0)
+#else
+#define _STARPU_PTHREAD_MUTEX_UNLOCK(mutex) do {                               \
+	int p_ret = pthread_mutex_unlock(mutex);                               \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_mutex_unlock: %s\n",                    \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+typedef xbt_mutex_t _starpu_pthread_rwlock_t;
+#else
+typedef pthread_rwlock_t _starpu_pthread_rwlock_t;
+#endif
+/*
+ * Encapsulation of the pthread_rwlock_* functions.
+ */
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_RWLOCK_INIT(rwlock, attr) _STARPU_PTHREAD_MUTEX_INIT(rwlock, attr)
+#else
+#define _STARPU_PTHREAD_RWLOCK_INIT(rwlock, attr) do {                         \
+	int p_ret = pthread_rwlock_init((rwlock), (attr));                     \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_rwlock_init: %s\n",                     \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_RWLOCK_RDLOCK(rwlock) _STARPU_PTHREAD_MUTEX_LOCK(rwlock)
+#else
+#define _STARPU_PTHREAD_RWLOCK_RDLOCK(rwlock) do {                             \
+	int p_ret = pthread_rwlock_rdlock(rwlock);                             \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_rwlock_rdlock: %s\n",                   \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_RWLOCK_WRLOCK(rwlock) _STARPU_PTHREAD_MUTEX_LOCK(rwlock)
+#else
+#define _STARPU_PTHREAD_RWLOCK_WRLOCK(rwlock) do {                             \
+	int p_ret = pthread_rwlock_wrlock(rwlock);                             \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_rwlock_wrlock: %s\n",                   \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_RWLOCK_UNLOCK(rwlock) _STARPU_PTHREAD_MUTEX_UNLOCK(rwlock)
+#else
+#define _STARPU_PTHREAD_RWLOCK_UNLOCK(rwlock) do {                             \
+	int p_ret = pthread_rwlock_unlock(rwlock);                             \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_rwlock_unlock: %s\n",                   \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_RWLOCK_DESTROY(rwlock) _STARPU_PTHREAD_MUTEX_DESTROY(rwlock)
+#else
+#define _STARPU_PTHREAD_RWLOCK_DESTROY(rwlock) do {                            \
+	int p_ret = pthread_rwlock_destroy(rwlock);                            \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_rwlock_destroy: %s\n",                  \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+typedef xbt_cond_t _starpu_pthread_cond_t;
+#else
+typedef pthread_cond_t _starpu_pthread_cond_t;
+#endif
+/*
+ * Encapsulation of the pthread_cond_* functions.
+ */
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_COND_INITIALIZER NULL
+#define _STARPU_PTHREAD_COND_INIT(cond, attr) do {                             \
+	(*cond) = xbt_cond_init();                                             \
+} while (0)
+#else
+#define _STARPU_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER
+#define _STARPU_PTHREAD_COND_INIT(cond, attr) do {                             \
+	int p_ret = pthread_cond_init((cond), (attr));                         \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_cond_init: %s\n",                       \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_COND_DESTROY(cond) do {                                \
+	if (*cond)                                                             \
+		xbt_cond_destroy((*cond));                                     \
+} while (0)
+#else
+#define _STARPU_PTHREAD_COND_DESTROY(cond) do {                                \
+	int p_ret = pthread_cond_destroy(cond);                                \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_cond_destroy: %s\n",                    \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+			STARPU_ABORT();                                        \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_COND_SIGNAL(cond) do {                                 \
+	if (!*cond)                                                            \
+		_STARPU_PTHREAD_COND_INIT(cond, NULL);                         \
+	xbt_cond_signal((*cond));                                              \
+} while (0)
+#else
+#define _STARPU_PTHREAD_COND_SIGNAL(cond) do {                                 \
+	int p_ret = pthread_cond_signal(cond);                                 \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_cond_signal: %s\n",                     \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_COND_BROADCAST(cond) do {                              \
+	if (!*cond)                                                            \
+		_STARPU_PTHREAD_COND_INIT(cond, NULL);                         \
+	xbt_cond_broadcast((*cond));                                           \
+} while (0)
+#else
+#define _STARPU_PTHREAD_COND_BROADCAST(cond) do {                              \
+	int p_ret = pthread_cond_broadcast(cond);                              \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_cond_broadcast: %s\n",                  \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#ifdef STARPU_SIMGRID
+#define _STARPU_PTHREAD_COND_WAIT(cond, mutex) do {                            \
+	if (!*cond)                                                            \
+		_STARPU_PTHREAD_COND_INIT(cond, NULL);                         \
+	xbt_cond_wait((*cond), (*mutex));                                      \
+} while (0)
+#else
+#define _STARPU_PTHREAD_COND_WAIT(cond, mutex) do {                            \
+	int p_ret = pthread_cond_wait((cond), (mutex));                        \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_cond_wait: %s\n",                       \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+#endif
+
+#define _starpu_pthread_barrier_t pthread_barrier_t
+/*
+ * Encapsulation of the pthread_barrier_* functions.
+ */
+#define _STARPU_PTHREAD_BARRIER_INIT(barrier, attr, count) do {                \
+	int p_ret = pthread_barrier_init((barrier), (attr), (count));          \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_barrier_init: %s\n",                    \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+
+#define _STARPU_PTHREAD_BARRIER_DESTROY(barrier) do {                          \
+	int p_ret = pthread_barrier_destroy((barrier));                        \
+	if (STARPU_UNLIKELY(p_ret)) {                                          \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_barrier_destroy: %s\n",                 \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+		STARPU_ABORT();                                                \
+	}                                                                      \
+} while (0)
+
+#define _STARPU_PTHREAD_BARRIER_WAIT(barrier) do {                             \
+	int p_ret = pthread_barrier_wait(barrier);                             \
+	if (STARPU_UNLIKELY(!((p_ret == 0) || (p_ret == PTHREAD_BARRIER_SERIAL_THREAD)))) { \
+		fprintf(stderr,                                                \
+			"%s:%d pthread_barrier_wait: %s\n",                    \
+			__FILE__, __LINE__, strerror(p_ret));                  \
+			STARPU_ABORT();                                        \
+	}                                                                      \
+} while (0)
+
+#ifdef HAVE_PTHREAD_SPIN_LOCK
+typedef pthread_spinlock_t _starpu_pthread_spinlock_t;
+#endif
+
+#endif /* __COMMON_THREAD_H__ */
+
+

+ 1 - 0
src/common/utils.c

@@ -18,6 +18,7 @@
 #include <starpu.h>
 #include <common/config.h>
 #include <common/utils.h>
+#include <common/thread.h>
 #include <libgen.h>
 #include <errno.h>
 #include <unistd.h>

+ 1 - 377
src/common/utils.h

@@ -22,14 +22,9 @@
 #include <common/config.h>
 #include <sys/stat.h>
 #include <string.h>
-#include <pthread.h>
 #include <stdlib.h>
 #include <math.h>
-
-#ifdef STARPU_SIMGRID
-#include <xbt/synchro_core.h>
-#include <msg/msg.h>
-#endif
+#include <pthread.h>
 
 #ifdef STARPU_HAVE_HELGRIND_H
 #include <valgrind/helgrind.h>
@@ -106,14 +101,8 @@
 
 #define _STARPU_IS_ZERO(a) (fpclassify(a) == FP_ZERO)
 
-#ifdef STARPU_SIMGRID
-typedef xbt_mutex_t _starpu_pthread_mutex_t;
-#else
-typedef pthread_mutex_t _starpu_pthread_mutex_t;
-#endif
 int _starpu_mkpath(const char *s, mode_t mode);
 void _starpu_mkpath_and_check(const char *s, mode_t mode);
-int _starpu_check_mutex_deadlock(_starpu_pthread_mutex_t *mutex);
 char *_starpu_get_home_path(void);
 void _starpu_gethostname(char *hostname, size_t size);
 
@@ -128,369 +117,4 @@ struct starpu_codelet;
 /* Returns the symbol associated to that job if any. */
 const char *_starpu_codelet_get_model_name(struct starpu_codelet *cl);
 
-struct _starpu_pthread_args {
-	void *(*f)(void*);
-	void *arg;
-};
-
-int _starpu_simgrid_thread_start(int argc, char *argv[]);
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_CREATE_ON(name, thread, attr, routine, threadarg, where) do {\
-	struct _starpu_pthread_args *_args = malloc(sizeof(*_args));           \
-	xbt_dynar_t _hosts;                                                    \
-	_args->f = routine;                                                    \
-	_args->arg = threadarg;                                                \
-	_hosts = MSG_hosts_as_dynar();                                         \
-	MSG_process_create((name), _starpu_simgrid_thread_start, _args,        \
-			xbt_dynar_get_as(_hosts, (where), msg_host_t));        \
-	xbt_dynar_free(&_hosts);                                               \
-} while (0)
-#else
-#define _STARPU_PTHREAD_CREATE_ON(name, thread, attr, routine, arg, where) do {\
-	int p_ret = pthread_create((thread), (attr), (routine), (arg));	       \
-	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_create: %s\n",                          \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-	}                                                                      \
-} while (0)
-#endif
-#define _STARPU_PTHREAD_CREATE(name, thread, attr, routine, arg)               \
-	_STARPU_PTHREAD_CREATE_ON(name, thread, attr, routine, arg, 0)
-
-/*
- * Encapsulation of the pthread_key_* functions.
- */
-#ifdef STARPU_SIMGRID
-typedef int _starpu_pthread_key_t;
-int _starpu_pthread_key_create(_starpu_pthread_key_t *key);
-#define _STARPU_PTHREAD_KEY_CREATE(key, destr) _starpu_pthread_key_create(key)
-int _starpu_pthread_key_delete(_starpu_pthread_key_t key);
-#define _STARPU_PTHREAD_KEY_DELETE(key) _starpu_pthread_key_delete(key)
-int _starpu_pthread_setspecific(_starpu_pthread_key_t key, void *ptr);
-#define _STARPU_PTHREAD_SETSPECIFIC(key, ptr) _starpu_pthread_setspecific(key, ptr)
-void *_starpu_pthread_getspecific(_starpu_pthread_key_t key);
-#define _STARPU_PTHREAD_GETSPECIFIC(key) _starpu_pthread_getspecific(key)
-#else
-typedef pthread_key_t _starpu_pthread_key_t;
-#define _STARPU_PTHREAD_KEY_CREATE(key, destr) do {                            \
-	int p_ret = pthread_key_create((key), (destr));	                       \
-	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_key_create: %s\n",                      \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-	}                                                                      \
-} while (0)
-
-#define _STARPU_PTHREAD_KEY_DELETE(key) do {                                   \
-	int p_ret = pthread_key_delete((key));	                               \
-	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_key_delete: %s\n",                      \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-	}                                                                      \
-} while (0)
-
-#define _STARPU_PTHREAD_SETSPECIFIC(key, ptr) do {                             \
-	int p_ret = pthread_setspecific((key), (ptr));	                       \
-	if (STARPU_UNLIKELY(p_ret != 0)) {                                     \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_setspecific: %s\n",                     \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-	};                                                                     \
-} while (0)
-
-#define _STARPU_PTHREAD_GETSPECIFIC(key) pthread_getspecific((key))
-#endif
-
-/*
- * Encapsulation of the pthread_mutex_* functions.
- */
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_MUTEX_INITIALIZER NULL
-#define _STARPU_PTHREAD_MUTEX_INIT(mutex, attr) do {                           \
-	(*mutex) = xbt_mutex_init();                                           \
-} while (0)
-#else
-#define _STARPU_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#define _STARPU_PTHREAD_MUTEX_INIT(mutex, attr) do {                           \
-	int p_ret = pthread_mutex_init((mutex), (attr));                       \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_mutex_init: %s\n",                      \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_MUTEX_DESTROY(mutex) do {                              \
-	if (*mutex)                                                            \
-		xbt_mutex_destroy((*mutex));                                   \
-} while (0)
-#else
-#define _STARPU_PTHREAD_MUTEX_DESTROY(mutex) do {                              \
-	int p_ret = pthread_mutex_destroy(mutex);                              \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_mutex_destroy: %s\n",                   \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while(0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_MUTEX_LOCK(mutex) do {                                 \
-	if (!(*mutex)) _STARPU_PTHREAD_MUTEX_INIT((mutex), NULL);              \
-	xbt_mutex_acquire((*mutex));                                           \
-} while (0)
-#else
-#define _STARPU_PTHREAD_MUTEX_LOCK(mutex) do {                                 \
-	int p_ret = pthread_mutex_lock(mutex);                                 \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_mutex_lock: %s\n",                      \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_MUTEX_TRYLOCK(mutex) (xbt_mutex_acquire(*mutex), 0)
-#else
-#define _STARPU_PTHREAD_MUTEX_TRYLOCK(mutex) pthread_mutex_trylock(mutex)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_MUTEX_UNLOCK(mutex) do {                               \
-	xbt_mutex_release((*mutex));                                           \
-} while (0)
-#else
-#define _STARPU_PTHREAD_MUTEX_UNLOCK(mutex) do {                               \
-	int p_ret = pthread_mutex_unlock(mutex);                               \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_mutex_unlock: %s\n",                    \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-typedef xbt_mutex_t _starpu_pthread_rwlock_t;
-#else
-typedef pthread_rwlock_t _starpu_pthread_rwlock_t;
-#endif
-/*
- * Encapsulation of the pthread_rwlock_* functions.
- */
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_RWLOCK_INIT(rwlock, attr) _STARPU_PTHREAD_MUTEX_INIT(rwlock, attr)
-#else
-#define _STARPU_PTHREAD_RWLOCK_INIT(rwlock, attr) do {                         \
-	int p_ret = pthread_rwlock_init((rwlock), (attr));                     \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_rwlock_init: %s\n",                     \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_RWLOCK_RDLOCK(rwlock) _STARPU_PTHREAD_MUTEX_LOCK(rwlock)
-#else
-#define _STARPU_PTHREAD_RWLOCK_RDLOCK(rwlock) do {                             \
-	int p_ret = pthread_rwlock_rdlock(rwlock);                             \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_rwlock_rdlock: %s\n",                   \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_RWLOCK_WRLOCK(rwlock) _STARPU_PTHREAD_MUTEX_LOCK(rwlock)
-#else
-#define _STARPU_PTHREAD_RWLOCK_WRLOCK(rwlock) do {                             \
-	int p_ret = pthread_rwlock_wrlock(rwlock);                             \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_rwlock_wrlock: %s\n",                   \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_RWLOCK_UNLOCK(rwlock) _STARPU_PTHREAD_MUTEX_UNLOCK(rwlock)
-#else
-#define _STARPU_PTHREAD_RWLOCK_UNLOCK(rwlock) do {                             \
-	int p_ret = pthread_rwlock_unlock(rwlock);                             \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_rwlock_unlock: %s\n",                   \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_RWLOCK_DESTROY(rwlock) _STARPU_PTHREAD_MUTEX_DESTROY(rwlock)
-#else
-#define _STARPU_PTHREAD_RWLOCK_DESTROY(rwlock) do {                            \
-	int p_ret = pthread_rwlock_destroy(rwlock);                            \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_rwlock_destroy: %s\n",                  \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-typedef xbt_cond_t _starpu_pthread_cond_t;
-#else
-typedef pthread_cond_t _starpu_pthread_cond_t;
-#endif
-/*
- * Encapsulation of the pthread_cond_* functions.
- */
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_COND_INITIALIZER NULL
-#define _STARPU_PTHREAD_COND_INIT(cond, attr) do {                             \
-	(*cond) = xbt_cond_init();                                             \
-} while (0)
-#else
-#define _STARPU_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER
-#define _STARPU_PTHREAD_COND_INIT(cond, attr) do {                             \
-	int p_ret = pthread_cond_init((cond), (attr));                         \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_cond_init: %s\n",                       \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_COND_DESTROY(cond) do {                                \
-	if (*cond)                                                             \
-		xbt_cond_destroy((*cond));                                     \
-} while (0)
-#else
-#define _STARPU_PTHREAD_COND_DESTROY(cond) do {                                \
-	int p_ret = pthread_cond_destroy(cond);                                \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_cond_destroy: %s\n",                    \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-			STARPU_ABORT();                                        \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_COND_SIGNAL(cond) do {                                 \
-	if (!*cond)                                                            \
-		_STARPU_PTHREAD_COND_INIT(cond, NULL);                         \
-	xbt_cond_signal((*cond));                                              \
-} while (0)
-#else
-#define _STARPU_PTHREAD_COND_SIGNAL(cond) do {                                 \
-	int p_ret = pthread_cond_signal(cond);                                 \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_cond_signal: %s\n",                     \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_COND_BROADCAST(cond) do {                              \
-	if (!*cond)                                                            \
-		_STARPU_PTHREAD_COND_INIT(cond, NULL);                         \
-	xbt_cond_broadcast((*cond));                                           \
-} while (0)
-#else
-#define _STARPU_PTHREAD_COND_BROADCAST(cond) do {                              \
-	int p_ret = pthread_cond_broadcast(cond);                              \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_cond_broadcast: %s\n",                  \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#ifdef STARPU_SIMGRID
-#define _STARPU_PTHREAD_COND_WAIT(cond, mutex) do {                            \
-	if (!*cond)                                                            \
-		_STARPU_PTHREAD_COND_INIT(cond, NULL);                         \
-	xbt_cond_wait((*cond), (*mutex));                                      \
-} while (0)
-#else
-#define _STARPU_PTHREAD_COND_WAIT(cond, mutex) do {                            \
-	int p_ret = pthread_cond_wait((cond), (mutex));                        \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_cond_wait: %s\n",                       \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-#endif
-
-#define _starpu_pthread_barrier_t pthread_barrier_t
-/*
- * Encapsulation of the pthread_barrier_* functions.
- */
-#define _STARPU_PTHREAD_BARRIER_INIT(barrier, attr, count) do {                \
-	int p_ret = pthread_barrier_init((barrier), (attr), (count));          \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_barrier_init: %s\n",                    \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-
-#define _STARPU_PTHREAD_BARRIER_DESTROY(barrier) do {                          \
-	int p_ret = pthread_barrier_destroy((barrier));                        \
-	if (STARPU_UNLIKELY(p_ret)) {                                          \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_barrier_destroy: %s\n",                 \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-		STARPU_ABORT();                                                \
-	}                                                                      \
-} while (0)
-
-#define _STARPU_PTHREAD_BARRIER_WAIT(barrier) do {                             \
-	int p_ret = pthread_barrier_wait(barrier);                             \
-	if (STARPU_UNLIKELY(!((p_ret == 0) || (p_ret == PTHREAD_BARRIER_SERIAL_THREAD)))) { \
-		fprintf(stderr,                                                \
-			"%s:%d pthread_barrier_wait: %s\n",                    \
-			__FILE__, __LINE__, strerror(p_ret));                  \
-			STARPU_ABORT();                                        \
-	}                                                                      \
-} while (0)
-
-#ifdef HAVE_PTHREAD_SPIN_LOCK
-typedef pthread_spinlock_t _starpu_pthread_spinlock_t;
-#endif
-
 #endif // __COMMON_UTILS_H__

+ 2 - 2
src/core/task_bundle.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2012 Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -23,7 +23,7 @@
 #  include <pthread.h>
 #endif
 
-#include <common/utils.h>
+#include <common/thread.h>
 
 /* struct _starpu_task_bundle_entry
  * ================================

+ 1 - 1
src/top/starpu_top_message_queue.h

@@ -18,7 +18,7 @@
 #include <sys/types.h>
 #include <semaphore.h>
 #include <pthread.h>
-#include <common/utils.h>
+#include <common/thread.h>
 
 #ifndef __STARPU_TOP_MESSAGE_QUEUE_H__
 #define __STARPU_TOP_MESSAGE_QUEUE_H__

+ 2 - 1
tests/datawizard/dsm_stress.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #ifdef STARPU_QUICK_CHECK
 #  define N	100

+ 2 - 1
tests/datawizard/mpi_like.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #define NTHREADS	4
 #define NITER		2

+ 1 - 0
tests/datawizard/mpi_like_async.c

@@ -19,6 +19,7 @@
 #include <starpu.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #ifdef STARPU_QUICK_CHECK
 #  define NTHREADS_DEFAULT	4

+ 1 - 0
tests/datawizard/sync_with_data_with_mem_non_blocking.c

@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #define NBUFFERS_DEF	64
 #define NITER_DEF	128

+ 1 - 0
tests/datawizard/sync_with_data_with_mem_non_blocking_implicit.c

@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #define NBUFFERS_DEF	64
 #define NITER_DEF	128

+ 2 - 1
tests/main/execute_on_a_specific_worker.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #ifdef STARPU_QUICK_CHECK
   #define N 100

+ 2 - 1
tests/main/regenerate.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -21,6 +21,7 @@
 #include <pthread.h>
 #include <starpu.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #ifdef STARPU_QUICK_CHECK
 static unsigned ntasks = 64;

+ 2 - 1
tests/main/subgraph_repeat.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -18,6 +18,7 @@
 #include <sys/time.h>
 #include <starpu.h>
 #include <pthread.h>
+#include <common/thread.h>
 
 #include "../helper.h"
 

+ 2 - 1
tests/main/subgraph_repeat_regenerate.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -18,6 +18,7 @@
 #include <sys/time.h>
 #include <starpu.h>
 #include <pthread.h>
+#include <common/thread.h>
 
 #include "../helper.h"
 

+ 2 - 1
tests/main/subgraph_repeat_regenerate_tag.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -18,6 +18,7 @@
 #include <sys/time.h>
 #include <starpu.h>
 #include <pthread.h>
+#include <common/thread.h>
 
 #include "../helper.h"
 

+ 2 - 1
tests/overlap/overlap.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2012  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include "../helper.h"
+#include <common/thread.h>
 
 #ifdef STARPU_QUICK_CHECK
 #define NTASKS	1000