STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
threads.h
Go to the documentation of this file.
1 /* threads.h -- header for threads library */
2 #pragma once
3 #ifndef _THR_THREADS_H
4 #define _THR_THREADS_H
5 #ifndef RC_INVOKED
6 #include <thr/xthreads.h>
7 
8  #pragma pack(push,_CRT_PACKING)
9  #pragma warning(push,3)
10  #pragma push_macro("new")
11  #undef new
12 
14 enum { /* return codes */
20  };
21 
22  /* threads */
23 typedef _Thrd_t thrd_t;
25 
26 #define thrd_create(thr, fun, arg) _Thrd_create(thr, fun, arg)
27 
28 #define thrd_detach(thr) _Thrd_detach(thr)
29 #define thrd_exit(code) _Thrd_exit(code)
30 #define thrd_join(thr, res) _Thrd_join(thr, res)
31 #define thrd_sleep(tm) _Thrd_sleep(tm)
32 #define thrd_yield _Thrd_yield
33 #define thrd_equal(thr0, thr1) _Thrd_equal(thr0, thr1)
34 #define thrd_current _Thrd_current
35 
36  /* mutexes */
37 typedef _Mtx_imp_t mtx_t;
38 enum { /* mutex types */
43  };
44 
45 #define mtx_init(mtx, typ) _Mtx_init(mtx, typ)
46 #define mtx_destroy(mtx) _Mtx_destroy(mtx)
47 #define mtx_current_owns(mtx) _Mtx_current_owns(mtx)
48 #define mtx_lock(mtx) _Mtx_lock(mtx)
49 #define mtx_trylock(mtx) _Mtx_trylock(mtx)
50 #define mtx_timedlock(mtx, tm) _Mtx_timedlock(mtx, tm)
51 #define mtx_unlock(mtx) _Mtx_unlock(mtx)
52 
53  /* condition variables */
54 typedef _Cnd_t cnd_t;
55 
56 #define cnd_init(cnd) _Cnd_init(cnd)
57 #define cnd_destroy(cnd) _Cnd_destroy(cnd)
58 #define cnd_timedwait(cnd, mtx, tm) _Cnd_timedwait(cnd, mtx, tm)
59 #define cnd_wait(cnd, mtx) _Cnd_wait(cnd, mtx)
60 #define cnd_broadcast(cnd) _Cnd_broadcast(cnd)
61 #define cnd_broadcast_at_thread_exit(cnd, mtx) \
62  _Cnd_register_at_thread_exit(cnd, mtx, 0)
63 #define cnd_signal(cnd) _Cnd_signal(cnd)
64 
65  /* thread specific storage */
66 typedef _Tss_t tss_t;
68 #define TSS_DTOR_ITERATIONS _TSS_DTOR_ITERATIONS
69 
70 #define tss_create(key, dtor) _Tss_create(key, dtor)
71 #define tss_delete(key) _Tss_delete(key)
72 #define tss_set(key, value) _Tss_set(key, value)
73 #define tss_get(key) _Tss_get(key)
74 
75  /* once functions */
76 #define ONCE_FLAG_INIT _ONCE_FLAG_INIT
79 #define call_once(flg, once) _Call_once(flg, once)
80 
81  /* utility functions */
82 #define thread_abort _Thread_abort
83 
85  #pragma pop_macro("new")
86  #pragma warning(pop)
87  #pragma pack(pop)
88 #endif /* RC_INVOKED */
89 #endif /* _THR_THREADS_H */
90 
91 /*
92  * This file is derived from software bearing the following
93  * restrictions:
94  *
95  * (c) Copyright William E. Kempf 2001
96  *
97  * Permission to use, copy, modify, distribute and sell this
98  * software and its documentation for any purpose is hereby
99  * granted without fee, provided that the above copyright
100  * notice appear in all copies and that both that copyright
101  * notice and this permission notice appear in supporting
102  * documentation. William E. Kempf makes no representations
103  * about the suitability of this software for any purpose.
104  * It is provided "as is" without express or implied warranty.
105  */
106 
107 /*
108  * Copyright (c) 1992-2012 by P.J. Plauger. ALL RIGHTS RESERVED.
109  * Consult your license regarding permissions and restrictions.
110 V6.00:0009 */
Definition: xthreads.h:42
Definition: threads.h:17
void(* _Tss_dtor_t)(void *)
Definition: xthreads.h:75
_Once_flag once_flag
Definition: threads.h:77
Definition: threads.h:40
Definition: xthrcommon.h:34
Definition: threads.h:42
Definition: xthreads.h:21
_Once_flag_imp_t _Once_flag
Definition: xthreads.h:95
_Cnd_t cnd_t
Definition: threads.h:54
Definition: threads.h:39
_Tss_t tss_t
Definition: threads.h:66
_Tss_imp_t _Tss_t
Definition: xthreads.h:74
Definition: threads.h:15
Definition: threads.h:41
_Tss_dtor_t tss_dtor_t
Definition: threads.h:67
struct _Mtx_internal_imp_t * _Mtx_imp_t
Definition: xthrcommon.h:45
Definition: xthreads.h:17
_Cnd_imp_t _Cnd_t
Definition: xthreads.h:61
_Thrd_start_t thrd_start_t
Definition: threads.h:24
_Thrd_t thrd_t
Definition: threads.h:23
Definition: xthreads.h:20
Definition: xthreads.h:45
Definition: xthreads.h:18
Definition: xthreads.h:44
_Mtx_imp_t mtx_t
Definition: threads.h:37
int(* _Thrd_start_t)(void *)
Definition: xthreads.h:26
_Once_callback_t once_callback_t
Definition: threads.h:78
Definition: threads.h:16
#define _END_C_LIB_DECL
Definition: yvals.h:562
void(__cdecl * _Once_callback_t)(void)
Definition: xthreads.h:97
#define _C_LIB_DECL
Definition: yvals.h:561
Definition: threads.h:19
Definition: xthreads.h:19
Definition: xthreads.h:43
Definition: threads.h:18