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,_STL_WARNING_LEVEL)
12  #pragma warning(disable: _STL_DISABLED_WARNINGS)
13  #pragma push_macro("new")
14  #undef new
15 
17 enum { /* return codes */
23  };
24 
25  /* threads */
27 typedef int (*_Thrd_start_t)(void *);
28 
29 _CRTIMP2_PURE int __cdecl _Thrd_create(_Thrd_t *, _Thrd_start_t, void *);
30 
32 _CRTIMP2_PURE void __cdecl _Thrd_exit(int);
33 _CRTIMP2_PURE int __cdecl _Thrd_join(_Thrd_t, int *);
34 _CRTIMP2_PURE void __cdecl _Thrd_sleep(const xtime*);
35 _CRTIMP2_PURE void __cdecl _Thrd_yield(void);
36 _CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency(void);
38 _CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current(void);
39 _CRTIMP2_PURE _Thrd_id_t __cdecl _Thrd_id(void);
40 
41  /* mutexes */
43 enum { /* mutex types */
44  _Mtx_plain = 0x01,
45  _Mtx_try = 0x02,
46  _Mtx_timed = 0x04,
48  };
49 
50 _CRTIMP2_PURE int __cdecl _Mtx_init(_Mtx_t *, int);
51 _CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t);
52 _CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int);
55 _CRTIMP2_PURE int __cdecl _Mtx_lock(_Mtx_t);
56 _CRTIMP2_PURE int __cdecl _Mtx_trylock(_Mtx_t);
57 _CRTIMP2_PURE int __cdecl _Mtx_timedlock(_Mtx_t, const xtime *);
58 _CRTIMP2_PURE int __cdecl _Mtx_unlock(_Mtx_t);
59 
63 
64  /* shared mutex */
65  /* these declarations must be in sync with those in thr/sharedmutex.cpp */
66 typedef void * _Smtx_t;
67 void __cdecl _Smtx_lock_exclusive(_Smtx_t *);
68 void __cdecl _Smtx_lock_shared(_Smtx_t *);
69 int __cdecl _Smtx_try_lock_exclusive(_Smtx_t *);
70 int __cdecl _Smtx_try_lock_shared(_Smtx_t *);
71 void __cdecl _Smtx_unlock_exclusive(_Smtx_t *);
72 void __cdecl _Smtx_unlock_shared(_Smtx_t *);
73 
74  /* condition variables */
76 
77 _CRTIMP2_PURE int __cdecl _Cnd_init(_Cnd_t *);
78 _CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t);
81 _CRTIMP2_PURE int __cdecl _Cnd_wait(_Cnd_t, _Mtx_t);
83  _Mtx_t, const xtime *);
85 _CRTIMP2_PURE int __cdecl _Cnd_signal(_Cnd_t);
87  _Mtx_t, int *);
90 
91  /* thread specific storage */
93 typedef void (*_Tss_dtor_t)(void *);
95 
96 _CRTIMP2_PURE int __cdecl _Tss_delete(_Tss_t);
97 _CRTIMP2_PURE int __cdecl _Tss_set(_Tss_t, void *);
98 _CRTIMP2_PURE void *__cdecl _Tss_get(_Tss_t);
99 
100 #define _TSS_DTOR_ITERATIONS _TSS_DTOR_ITERATIONS_IMP
101 
102  #if _TSS_USE_MACROS
103  #define _Tss_create(key, dtor) _TSS_CREATE(key, dtor)
104  #define _Tss_delete(key) _TSS_DELETE(key)
105  #define _Tss_set(key, value) _TSS_SET(key, value)
106  #define _Tss_get(key) _TSS_GET(key)
107  #endif /* TSS_USE_MACROS */
108 
109  /* utility functions */
110 _CRTIMP2_PURE void __cdecl _Thrd_abort(const char *);
112  #pragma pop_macro("new")
113  #pragma warning(pop)
114  #pragma pack(pop)
115 #endif /* RC_INVOKED */
116 #endif /* _THR_XTHREADS_H */
117 
118 /*
119  * This file is derived from software bearing the following
120  * restrictions:
121  *
122  * (c) Copyright William E. Kempf 2001
123  *
124  * Permission to use, copy, modify, distribute and sell this
125  * software and its documentation for any purpose is hereby
126  * granted without fee, provided that the above copyright
127  * notice appear in all copies and that both that copyright
128  * notice and this permission notice appear in supporting
129  * documentation. William E. Kempf makes no representations
130  * about the suitability of this software for any purpose.
131  * It is provided "as is" without express or implied warranty.
132  */
133 
134 /*
135  * Copyright (c) by P.J. Plauger. All rights reserved.
136  * Consult your license regarding permissions and restrictions.
137 V6.50:0009 */
_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t)
void __cdecl _Smtx_lock_shared(_Smtx_t *)
#define _END_EXTERN_C
Definition: yvals.h:573
_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t)
int __cdecl _Smtx_try_lock_shared(_Smtx_t *)
Definition: xthreads.h:45
_CRTIMP2_PURE void __cdecl _Thrd_yield(void)
_CRTIMP2_PURE void __cdecl _Cnd_register_at_thread_exit(_Cnd_t, _Mtx_t, int *)
void __cdecl _Smtx_unlock_exclusive(_Smtx_t *)
_CRTIMP2_PURE void __cdecl _Thrd_sleep(const xtime *)
Definition: xthreads.h:19
void __cdecl _Smtx_unlock_shared(_Smtx_t *)
_CRTIMP2_PURE int __cdecl _Cnd_timedwait(_Cnd_t, _Mtx_t, const xtime *)
_CRTIMP2_PURE void *__cdecl _Tss_get(_Tss_t)
Definition: xthreads.h:21
_CRTIMP2_PURE void __cdecl _Cnd_do_broadcast_at_thread_exit(void)
void(* _Tss_dtor_t)(void *)
Definition: xthreads.h:93
_CRTIMP2_PURE _Thrd_id_t __cdecl _Thrd_id(void)
_CRTIMP2_PURE int __cdecl _Mtx_lock(_Mtx_t)
_CRTIMP2_PURE void *__cdecl _Mtx_getconcrtcs(_Mtx_t)
Definition: xthrcommon.h:32
void __cdecl _Smtx_lock_exclusive(_Smtx_t *)
_CRTIMP2_PURE int __cdecl _Thrd_join(_Thrd_t, int *)
struct _Cnd_internal_imp_t * _Cnd_imp_t
Definition: xthrcommon.h:73
_CRTIMP2_PURE void __cdecl _Thrd_abort(const char *)
_Tss_imp_t _Tss_t
Definition: xthreads.h:92
_CRTIMP2_PURE int __cdecl _Thrd_equal(_Thrd_t, _Thrd_t)
_CRTIMP2_PURE int __cdecl _Mtx_init(_Mtx_t *, int)
Definition: xthreads.h:18
#define _EXTERN_C
Definition: yvals.h:572
_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_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:71
int __cdecl _Smtx_try_lock_exclusive(_Smtx_t *)
_CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency(void)
_CRTIMP2_PURE int __cdecl _Cnd_init(_Cnd_t *)
Definition: xthreads.h:44
_CRTIMP2_PURE int __cdecl _Mtx_trylock(_Mtx_t)
Definition: xtimec.h:19
unsigned int _Thrd_id_t
Definition: xthrcommon.h:31
_CRTIMP2_PURE int __cdecl _Tss_set(_Tss_t, void *)
_CRT_BEGIN_C_HEADER typedef void(__CRTDECL *terminate_handler)()
_CRTIMP2_PURE void __cdecl _Thrd_exit(int)
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45
_Mtx_imp_t _Mtx_t
Definition: xthreads.h:42
_CRTIMP2_PURE int __cdecl _Tss_create(_Tss_t *, _Tss_dtor_t)
_Cnd_imp_t _Cnd_t
Definition: xthreads.h:75
_CRTIMP2_PURE void __cdecl _Mtx_clear_owner(_Mtx_t)
_CRTIMP2_PURE int __cdecl _Mtx_timedlock(_Mtx_t, const xtime *)
_CRTIMP2_PURE int __cdecl _Mtx_unlock(_Mtx_t)
_CRTIMP2_PURE void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t)
_CRTIMP2_PURE int __cdecl _Thrd_detach(_Thrd_t)
_Thrd_imp_t _Thrd_t
Definition: xthreads.h:26
_CRTIMP2_PURE void __cdecl _Mtx_reset_owner(_Mtx_t)
_CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t)
int _Tss_imp_t
Definition: xthrcommon.h:74
Definition: xthreads.h:22
void * _Smtx_t
Definition: xthreads.h:66
_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t)
_CRTIMP2_PURE int __cdecl _Cnd_signal(_Cnd_t)
int(* _Thrd_start_t)(void *)
Definition: xthreads.h:27
Definition: xthreads.h:46
Definition: xthreads.h:20
_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t)
_CRTIMP2_PURE _Thrd_t __cdecl _Thrd_current(void)
_CRTIMP2_PURE int __cdecl _Cnd_broadcast(_Cnd_t)
_CRTIMP2_PURE int __cdecl _Tss_delete(_Tss_t)
Definition: xthreads.h:47
#define _CRTIMP2_PURE
Definition: yvals.h:527
_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int)
_CRTIMP2_PURE int __cdecl _Cnd_wait(_Cnd_t, _Mtx_t)