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) \
59  _Cnd_timedwait((*cnd), (*mtx), tm)
60 #define cnd_wait(cnd, mtx) \
61  _Cnd_wait((*cnd), (*mtx))
62 #define cnd_broadcast(cnd) _Cnd_broadcast((*cnd))
63 #define cnd_broadcast_at_thread_exit(cnd, mtx) \
64  _Cnd_register_at_thread_exit((*cnd), (*mtx), 0)
65 #define cnd_signal(cnd) _Cnd_signal((*cnd))
66 
67  /* thread specific storage */
68 typedef _Tss_t tss_t;
70 #define TSS_DTOR_ITERATIONS _TSS_DTOR_ITERATIONS
71 
72 #define tss_create(key, dtor) _Tss_create(key, dtor)
73 #define tss_delete(key) _Tss_delete(key)
74 #define tss_set(key, value) _Tss_set(key, value)
75 #define tss_get(key) _Tss_get(key)
76 
77  /* utility functions */
78 #define thread_abort _Thread_abort
79 
81  #pragma pop_macro("new")
82  #pragma warning(pop)
83  #pragma pack(pop)
84 #endif /* RC_INVOKED */
85 #endif /* _THR_THREADS_H */
86 
87 /*
88  * This file is derived from software bearing the following
89  * restrictions:
90  *
91  * (c) Copyright William E. Kempf 2001
92  *
93  * Permission to use, copy, modify, distribute and sell this
94  * software and its documentation for any purpose is hereby
95  * granted without fee, provided that the above copyright
96  * notice appear in all copies and that both that copyright
97  * notice and this permission notice appear in supporting
98  * documentation. William E. Kempf makes no representations
99  * about the suitability of this software for any purpose.
100  * It is provided "as is" without express or implied warranty.
101  */
102 
103 /*
104  * Copyright (c) by P.J. Plauger. All rights reserved.
105  * Consult your license regarding permissions and restrictions.
106 V6.50:0009 */
Definition: threads.h:40
Definition: xthreads.h:19
void(* _Tss_dtor_t)(void *)
Definition: xthreads.h:92
Definition: xthreads.h:18
Definition: xthrcommon.h:35
Definition: threads.h:15
_Cnd_t cnd_t
Definition: threads.h:54
Definition: xthreads.h:20
_Tss_t tss_t
Definition: threads.h:68
Definition: threads.h:19
_Tss_imp_t _Tss_t
Definition: xthreads.h:91
Definition: threads.h:16
_Tss_dtor_t tss_dtor_t
Definition: threads.h:69
Definition: threads.h:41
struct _Mtx_internal_imp_t * _Mtx_imp_t
Definition: xthrcommon.h:74
Definition: threads.h:17
Definition: xthreads.h:44
_Cnd_imp_t _Cnd_t
Definition: xthreads.h:74
_Thrd_start_t thrd_start_t
Definition: threads.h:24
Definition: xthreads.h:43
_Thrd_t thrd_t
Definition: threads.h:23
Definition: xthreads.h:21
Definition: threads.h:42
Definition: threads.h:39
_Mtx_imp_t mtx_t
Definition: threads.h:37
int(* _Thrd_start_t)(void *)
Definition: xthreads.h:26
Definition: xthreads.h:46
Definition: xthreads.h:45
Definition: xthreads.h:17
#define _END_C_LIB_DECL
Definition: yvals.h:573
Definition: threads.h:18
#define _C_LIB_DECL
Definition: yvals.h:572