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