1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 namespace jmmcg {
22
23 namespace NTUtils {
24 class win_exception;
25 }
26
27 namespace ppd {
28
29 namespace NTUtils {
30 class recursive_anon_mutex;
31 class anon_event;
32 class recursive_critical_section;
33 class recursive_mutex;
34 class event;
35 class semaphore;
36 }
37
38 template<>
39 struct api_lock_traits<generic_traits::MS_Win32, heavyweight_threading> {
40 static constexpr generic_traits::api_type api_type=generic_traits::MS_Win32;
41 typedef heavyweight_threading model_type;
42 enum atomic_state_type {
43 atom_set=WAIT_OBJECT_0,
44 atom_abandoned=WAIT_ABANDONED,
45 atom_already_set,
46 atom_max_recurse,
47 atom_deadlocked,
48 atom_perm_error,
49 atom_failed=WAIT_FAILED,
50 atom_interrupted,
51 atom_unset=WAIT_TIMEOUT,
52 atom_errno
53 };
54
55 typedef jmmcg::ppd::NTUtils::recursive_anon_mutex anon_mutex_type;
56
57 typedef jmmcg::ppd::NTUtils::recursive_anon_mutex nonrecursive_anon_mutex_type;
58 typedef jmmcg::ppd::NTUtils::recursive_anon_mutex recursive_anon_mutex_type;
59 typedef jmmcg::ppd::NTUtils::anon_event anon_event_type;
60 typedef jmmcg::ppd::NTUtils::recursive_critical_section critical_section_type;
61 typedef jmmcg::ppd::NTUtils::recursive_critical_section recursive_critical_section_type;
62 typedef jmmcg::ppd::NTUtils::recursive_mutex mutex_type;
63 typedef jmmcg::ppd::NTUtils::recursive_mutex recursive_mutex_type;
64 typedef jmmcg::ppd::NTUtils::event event_type;
65 typedef jmmcg::ppd::NTUtils::anon_semaphore anon_semaphore_type;
66 typedef jmmcg::ppd::NTUtils::semaphore semaphore_type;
67 template<class V>
68 struct atomic_counter_type : atomic_ctr<V, api_lock_traits<api_type, model_type> > {
69 typedef atomic_ctr<V, api_lock_traits<api_type, model_type> > base_t;
70 typedef typename base_t::lock_traits lock_traits;
71 typedef typename base_t::atomic_t atomic_t;
72 typedef typename base_t::value_type value_type;
73
74 atomic_counter_type() : base_t() {}
75 explicit atomic_counter_type(const value_type v) : base_t(v) {}
76 atomic_counter_type(atomic_counter_type const &a) : base_t(a) {}
77 atomic_counter_type(base_t const &a) : base_t(a) {}
78 };
79 typedef HANDLE handle_type;
80 typedef DWORD timeout_type;
81
82 typedef jmmcg::NTUtils::win_exception exception_type;
83
84 static const timeout_type __fastcall infinite_timeout() noexcept(true) {
85 return static_cast<timeout_type>(INFINITE);
86 }
87 };
88
89 template<>
90 struct api_threading_traits<generic_traits::api_type::no_api, sequential_mode> : api_threading_traits<generic_traits::MS_Win32, sequential_mode> {};
91
92 } }
93
94 #include "thread_api_traits_impl.hpp"