Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'clean_events' of github.com:Takishipp/simgrid into clean_events
[simgrid.git] / teshsuite / smpi / mpich3-test / include / mpithreadtest.h
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2001 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 #ifndef MPITHREADTEST_H_INCLUDED
8 #define MPITHREADTEST_H_INCLUDED
9
10 #include "mpitestconf.h"
11
12 /*
13    Define routines to start a thread for different thread packages.
14    The routine that is started is expected to return data when it
15    exits; the type of this data is
16
17    MTEST_THREAD_RETURN_TYPE
18 */
19
20 #ifdef HAVE_WINDOWS_H
21 #include <windows.h>
22 #define MTEST_THREAD_RETURN_TYPE DWORD
23 #define MTEST_THREAD_HANDLE HANDLE
24 #define MTEST_THREAD_LOCK_TYPE HANDLE
25 #elif defined(HAVE_PTHREAD_H)
26 #include <pthread.h>
27 #define MTEST_THREAD_RETURN_TYPE void *
28 #define MTEST_THREAD_HANDLE pthread_t
29 #define MTEST_THREAD_LOCK_TYPE pthread_mutex_t
30 #else
31 #error Unknown Thread Package
32 #endif
33
34 /* A dummy retval that is ignored */
35 #define MTEST_THREAD_RETVAL_IGN 0
36
37 int MTest_Start_thread(MTEST_THREAD_RETURN_TYPE(*fn) (void *p), void *arg);
38 int MTest_Join_threads(void);
39 int MTest_thread_lock_create(MTEST_THREAD_LOCK_TYPE *);
40 int MTest_thread_lock(MTEST_THREAD_LOCK_TYPE *);
41 int MTest_thread_unlock(MTEST_THREAD_LOCK_TYPE *);
42 int MTest_thread_lock_free(MTEST_THREAD_LOCK_TYPE *);
43 int MTest_thread_barrier_init(void);
44 int MTest_thread_barrier(int);
45 int MTest_thread_barrier_free(void);
46 #endif