/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to libssts/Thread.h

  • Committer: Gustav Hartvigsson
  • Date: 2018-12-04 21:17:43 UTC
  • mto: This revision was merged to the branch mainline in revision 153.
  • Revision ID: gustav.hartvigsson@gmail.com-20181204211743-ki25ei1fkx44b0wp
* fixed... sort of... the Meson Build system... Still buggy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
#include "config.h"
11
11
 
12
 
#if  !__STDC_NO_ATOMICS__
13
 
#include <stdatomic.h>
14
 
#else
 
12
//#if  !__STDC_NO_ATOMICS__
 
13
//#include <stdatomic.h>
 
14
//#else
15
15
#include "external/stdatomic.h"
16
 
#endif
 
16
//#endif
17
17
 
18
 
#if !__STDC_NO_THREADS__
19
 
#include <threads.h>
20
 
#else
 
18
//#if !__STDC_NO_THREADS__
 
19
//#include <threads.h>
 
20
//#else
21
21
#include "external/tinycthread.h"
22
 
#endif
 
22
//#endif
23
23
 
24
24
 
25
25
/**
43
43
 * offten used as return values for different fuctions.
44
44
 */
45
45
typedef enum {
46
 
  S_THREAD_STATUS_SUCCESS    = thrd_success,  /*< Succes*/
47
 
  S_THREAD_STATUS_TIMEOUT    = thrd_timedout, /*< Timedout*/
48
 
  S_THREAD_STATUS_ERROR      = thrd_error,    /*< Error */
49
 
  S_THREAD_STATUS_BUSY       = thrd_busy,     /*< Busy */
50
 
  S_THREAD_STATUS_NO_MEM     = thrd_nomem,    /*< No memory*/
51
 
  S_THREAD_STATUS_LAST                        /*< Not used */
 
46
  S_THREAD_STATUS_SUCCESS    = thrd_success,  /**< Succes*/
 
47
  S_THREAD_STATUS_TIMEOUT    = thrd_timedout, /**< Timedout*/
 
48
  S_THREAD_STATUS_ERROR      = thrd_error,    /**< Error */
 
49
  S_THREAD_STATUS_BUSY       = thrd_busy,     /**< Busy */
 
50
  S_THREAD_STATUS_NO_MEM     = thrd_nomem,    /**< No memory*/
 
51
  S_THREAD_STATUS_LAST                        /**< Not used */
52
52
} SThreadStatus;
53
53
 
54
54
/**
83
83
 * These map 1:1 to the C11 flags.
84
84
 */
85
85
typedef enum {
86
 
 S_MUTEX_FLAG_PLAIN = mtx_plain, /**< Plain mutex */
87
 
 S_MUTEX_FLAG_TIMED = mtx_timed, /**< Timed mutex */
 
86
 S_MUTEX_FLAG_PLAIN     = mtx_plain,     /**< Plain mutex */
 
87
 S_MUTEX_FLAG_TIMED     = mtx_timed,     /**< Timed mutex */
88
88
 S_MUTEX_FLAG_RECURSIVE = mtx_recursive, /**< Recursive mutex */
89
89
 S_MUTEX_FLAG_LAST
90
90
} SMutexFlag;
163
163
/**
164
164
 * Check if a mutex is locked.
165
165
 *
166
 
 * Note that this operation is non-atomic and may be wrong. 
 
166
 * Note that this operation is non-atomic and may be wrong.
167
167
 */
168
168
S_EXPORTED
169
169
SThreadStatus
202
202
 
203
203
/**
204
204
 * Run the thread.
 
205
 *
 
206
 * @note You must pass the self object as part of the user_data object, or have
 
207
 *       the self object globally avalible. Otherwise you will not be able to
 
208
 *       stop the thread using s_thread_stop.
205
209
 */
206
210
S_EXPORTED
207
211
SThreadStatus