Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This is definitivly not a public interface: it is not provided in libsimgrid when...
[simgrid.git] / src / include / xbt / xbt_thread.h
1 /* $Id$ */
2
3 /* xbt/xbt_thread.h -- Thread portability layer                             */
4
5 /* Copyright (c) 2007 Martin Quinson. All rights reserved.                  */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10
11 #ifndef _XBT_THREAD_H
12 #define _XBT_THREAD_H
13
14 #include "xbt/misc.h" /* SG_BEGIN_DECL */
15 #include "xbt/function_types.h"
16
17 SG_BEGIN_DECL()
18
19 /** @addtogroup XBT_thread
20  *  @brief Thread portability layer
21  * 
22  *  This section describes the thread portability layer. It defines types and 
23  *  functions very close to the pthread API, but it's portable to windows too.
24  * 
25  *  @{
26  */
27
28   /** \brief Thread data type (opaque structure) */
29   typedef struct xbt_thread_       *xbt_thread_t;
30
31   XBT_PUBLIC(xbt_thread_t) xbt_thread_create(pvoid_f_pvoid_t start_routine,void* param);
32   XBT_PUBLIC(void) xbt_thread_exit(int *retcode);
33   XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
34   XBT_PUBLIC(void) xbt_thread_join(void);
35   XBT_PUBLIC(void) xbt_thread_yield(void);
36
37
38   /** \brief Thread mutex data type (opaque structure) */
39   typedef struct xbt_mutex_ *xbt_mutex_t;
40
41   XBT_PUBLIC(xbt_mutex_t) xbt_mutex_init(void);
42   XBT_PUBLIC(void)        xbt_mutex_lock(xbt_mutex_t mutex);
43   XBT_PUBLIC(void)        xbt_mutex_unlock(xbt_mutex_t mutex);
44   XBT_PUBLIC(void)        xbt_mutex_destroy(xbt_mutex_t mutex);
45
46
47   /** \brief Thread condition data type (opaque structure) */
48   typedef struct xbt_thcond_  *xbt_thcond_t;
49
50   XBT_PUBLIC(xbt_thcond_t) xbt_thcond_init(void);
51   XBT_PUBLIC(void)         xbt_thcond_wait(xbt_thcond_t cond,
52                                            xbt_mutex_t mutex);
53   XBT_PUBLIC(void)         xbt_thcond_signal(xbt_thcond_t cond);
54   XBT_PUBLIC(void)         xbt_thcond_broadcast(xbt_thcond_t cond);
55   XBT_PUBLIC(void)         xbt_thcond_destroy(xbt_thcond_t cond);
56
57 /** @} */
58
59 SG_END_DECL()
60
61 #endif /* _XBT_DICT_H */