STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
xthreads.h
Go to the documentation of this file.
1 /* xthreads.h -- internal header for threads library */
2 #pragma once
3 #ifndef _THR_XTHREADS_H
4 #define _THR_XTHREADS_H
5 #ifndef RC_INVOKED
6 #include <thr/xthrcommon.h>
7 #include <thr/xtimec.h>
8 #include <limits.h>
9 
10  #pragma pack(push,_CRT_PACKING)
11  #pragma warning(push,3)
12  #pragma push_macro("new")
13  #undef new
14 
16 enum { /* return codes */
22  };
23 
24  /* threads */
26 typedef int (*_Thrd_start_t)(void *);
27 
28 _CRTIMP2_PURE int __cdecl _Thrd_create(_Thrd_t *, _Thrd_start_t, void *);
29 
31 _CRTIMP2_PURE void __cdecl _Thrd_exit(int);
32 _CRTIMP2_PURE int __cdecl _Thrd_join(_Thrd_t, int *);
33 _CRTIMP2_PURE void __cdecl _Thrd_sleep(const xtime*);
34 _CRTIMP2_PURE void __cdecl _Thrd_yield(void);
37 _CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current(void);
38 
39  /* mutexes */
41 enum { /* mutex types */
42  _Mtx_plain = 0x01,
43  _Mtx_try = 0x02,
44  _Mtx_timed = 0x04,
46  };
47 
48 _CRTIMP2_PURE int __cdecl _Mtx_init(_Mtx_t *, int);
49 _CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t *);
51 _CRTIMP2_PURE int __cdecl _Mtx_lock(_Mtx_t *);
52 _CRTIMP2_PURE int __cdecl _Mtx_trylock(_Mtx_t *);
53 _CRTIMP2_PURE int __cdecl _Mtx_timedlock(_Mtx_t *, const xtime *);
54 _CRTIMP2_PURE int __cdecl _Mtx_unlock(_Mtx_t *);
55 
56 _CRTIMP2_PURE void *__cdecl _Mtx_getconcrtcs(_Mtx_t *);
57 _CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t *);
58 _CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t *);
59 
60  /* condition variables */
62 
63 _CRTIMP2_PURE int __cdecl _Cnd_init(_Cnd_t *);
64 _CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t *);
65 _CRTIMP2_PURE int __cdecl _Cnd_wait(_Cnd_t *, _Mtx_t *);
66 _CRTIMP2_PURE int __cdecl _Cnd_timedwait(_Cnd_t *, _Mtx_t *, const xtime *);
67 _CRTIMP2_PURE int __cdecl _Cnd_broadcast(_Cnd_t *);
68 _CRTIMP2_PURE int __cdecl _Cnd_signal(_Cnd_t *);
72 
73  /* thread specific storage */
75 typedef void (*_Tss_dtor_t)(void *);
77 
78 _CRTIMP2_PURE int __cdecl _Tss_delete(_Tss_t);
79 _CRTIMP2_PURE int __cdecl _Tss_set(_Tss_t, void *);
80 _CRTIMP2_PURE void *__cdecl _Tss_get(_Tss_t);
81 
82 #define _TSS_DTOR_ITERATIONS _TSS_DTOR_ITERATIONS_IMP
83 
84  #if _TSS_USE_MACROS
85  #define _Tss_create(key, dtor) _TSS_CREATE(key, dtor)
86  #define _Tss_delete(key) _TSS_DELETE(key)
87  #define _Tss_set(key, value) _TSS_SET(key, value)
88  #define _Tss_get(key) _TSS_GET(key)
89  #endif /* TSS_USE_MACROS */
90 
91  /* once functions */
92 #define _ONCE_FLAG_INIT _ONCE_FLAG_INIT_IMP
93 #define _ONCE_FLAG_CPP_INIT 0
94 
96 typedef int _Once_flag_cpp;
97 typedef void (__cdecl *_Once_callback_t)(void);
98 typedef void (__cdecl *_Once_callbackEx_t)(void *);
99 
102  void *);
103 
104  /* utility functions */
105 _CRTIMP2_PURE void __cdecl _Thrd_abort(const char *);
107  #pragma pop_macro("new")
108  #pragma warning(pop)
109  #pragma pack(pop)
110 #endif /* RC_INVOKED */
111 #endif /* _THR_XTHREADS_H */
112 
113 /*
114  * This file is derived from software bearing the following
115  * restrictions:
116  *
117  * (c) Copyright William E. Kempf 2001
118  *
119  * Permission to use, copy, modify, distribute and sell this
120  * software and its documentation for any purpose is hereby
121  * granted without fee, provided that the above copyright
122  * notice appear in all copies and that both that copyright
123  * notice and this permission notice appear in supporting
124  * documentation. William E. Kempf makes no representations
125  * about the suitability of this software for any purpose.
126  * It is provided "as is" without express or implied warranty.
127  */
128 
129 /*
130  * Copyright (c) 1992-2012 by P.J. Plauger. ALL RIGHTS RESERVED.
131  * Consult your license regarding permissions and restrictions.
132 V6.00:0009 */
_CRTIMP2_PURE int __cdecl _Mtx_trylock(_Mtx_t *)
Definition: xthreads.h:42
_CRTIMP2_PURE int __cdecl _Mtx_timedlock(_Mtx_t *, const xtime *)
_CRTIMP2_PURE void __cdecl _Thrd_yield(void)
_CRTIMP2_PURE int __cdecl _Cnd_wait(_Cnd_t *, _Mtx_t *)
char _Once_flag_imp_t
Definition: xthrcommon.h:50
_CRTIMP2_PURE void __cdecl _Thrd_sleep(const xtime *)
_CRTIMP2_PURE void __cdecl _Call_once(_Once_flag *, _Once_callback_t)
_CRTIMP2_PURE void *__cdecl _Tss_get(_Tss_t)
_CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t *)
void(* _Tss_dtor_t)(void *)
Definition: xthreads.h:75
int _Once_flag_cpp
Definition: xthreads.h:96
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
Definition: xthrcommon.h:34
typedef void(__cdecl *_se_translator_function)(unsigned int
_CRTIMP2_PURE int __cdecl _Thrd_join(_Thrd_t, int *)
Definition: xthreads.h:21
_Once_flag_imp_t _Once_flag
Definition: xthreads.h:95
_CRTIMP2_PURE void __cdecl _Call_onceEx(_Once_flag_cpp *, _Once_callbackEx_t, void *)
struct _Cnd_internal_imp_t * _Cnd_imp_t
Definition: xthrcommon.h:47
_CRTIMP2_PURE void __cdecl _Thrd_abort(const char *)
_Tss_imp_t _Tss_t
Definition: xthreads.h:74
_CRTIMP2_PURE int __cdecl _Cnd_do_broadcast_at_thread_exit(void)
_CRTIMP2_PURE int __cdecl _Cnd_register_at_thread_exit(_Cnd_t *, _Mtx_t *, int *)
_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t *)
_CRTIMP2_PURE int __cdecl _Thrd_equal(_Thrd_t, _Thrd_t)
_CRTIMP2_PURE int __cdecl _Mtx_init(_Mtx_t *, int)
void(__cdecl * _Once_callbackEx_t)(void *)
Definition: xthreads.h:98
_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t *)
_CRTIMP2_PURE int __cdecl _Thrd_create(_Thrd_t *, _Thrd_start_t, void *)
struct _Mtx_internal_imp_t * _Mtx_imp_t
Definition: xthrcommon.h:45
_CRTIMP2_PURE int __cdecl _Cnd_timedwait(_Cnd_t *, _Mtx_t *, const xtime *)
_CRTIMP2_PURE int __cdecl _Cnd_broadcast(_Cnd_t *)
_CRTIMP2_PURE int __cdecl _Cnd_init(_Cnd_t *)
_CRTIMP2_PURE int __cdecl _Cnd_signal(_Cnd_t *)
Definition: xtimec.h:22
_CRTIMP2_PURE int __cdecl _Mtx_unlock(_Mtx_t *)
_CRTIMP2_PURE int __cdecl _Tss_set(_Tss_t, void *)
_CRTIMP2_PURE void __cdecl _Thrd_exit(int)
_CRTIMP2_PURE void *__cdecl _Mtx_getconcrtcs(_Mtx_t *)
_Mtx_imp_t _Mtx_t
Definition: xthreads.h:40
_CRTIMP2_PURE int __cdecl _Tss_create(_Tss_t *, _Tss_dtor_t)
Definition: xthreads.h:17
_Cnd_imp_t _Cnd_t
Definition: xthreads.h:61
_CRTIMP2_PURE int __cdecl _Thrd_detach(_Thrd_t)
_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t *)
_Thrd_imp_t _Thrd_t
Definition: xthreads.h:25
Definition: xthreads.h:20
Definition: xthreads.h:45
int _Tss_imp_t
Definition: xthrcommon.h:48
Definition: xthreads.h:18
Definition: xthreads.h:44
_CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t *)
_CRTIMP2_PURE int __cdecl _Mtx_lock(_Mtx_t *)
_CRTIMP2_PURE int __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t *)
int(* _Thrd_start_t)(void *)
Definition: xthreads.h:26
_CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current(void)
_CRTIMP2_PURE int __cdecl _Tss_delete(_Tss_t)
#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
#define _CRTIMP2_PURE
Definition: yvals.h:483
Definition: xthreads.h:19
Definition: xthreads.h:43
_CRTIMP2_PURE int __cdecl _Thrd_lt(_Thrd_t, _Thrd_t)