acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
parallelization_winrt.h
1
#pragma once
2
3
//
4
//#define U32_INFINITE_TIMEOUT 0xffffffffu
5
//
6
//
7
//template < typename T >
8
//inline void waiter_null_result(T & t)
9
//{
10
// t = nullptr;
11
//}
12
//
13
//template < >
14
//inline void waiter_null_result(bool & b)
15
//{
16
// b = false;
17
//}
18
//
19
//template < >
20
//inline void waiter_null_result(::u32 & u)
21
//{
22
// u = NULL;
23
//}
24
//
25
//
26
//template < typename T >
27
//class waiter_for_Windows_Foundation_IAsyncOperation sealed
28
//{
29
//private:
30
//
31
//
32
// manual_reset_happening m_happening;
33
// ::winrt::Windows::Foundation::IAsyncOperation < T > m_operation;
34
// ::winrt::Windows::Foundation::AsyncStatus m_status;
35
// T m_result;
36
// HRESULT m_hresult;
37
//
38
//
39
//public:
40
//
41
//
42
// //waiter_for_Windows_Foundation_IAsyncOperation(::winrt::Windows::Foundation::IAsyncOperation < T > ^ operation, CallbackContext callbackcontext = CallbackContext::Any)
43
// waiter_for_Windows_Foundation_IAsyncOperation(::winrt::Windows::Foundation::IAsyncOperation < T > operation)
44
// {
45
//
46
// m_operation = operation;
47
//
48
// m_operation->Completed = ::winrt::Windows::Foundation::AsyncOperationCompletedHandler < T > ([this](::winrt::Windows::Foundation::IAsyncOperation < T > operation, ::winrt::Windows::Foundation::AsyncStatus status)
49
// {
50
//
51
// m_status = status;
52
//
53
// m_happening.set_happening();
54
//
55
// });
56
//
57
// }
58
//
59
//
60
// virtual ~waiter_for_Windows_Foundation_IAsyncOperation()
61
// {
62
//
63
// }
64
//
65
//
66
// T wait(::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
67
// {
68
//
69
// single_lock singlelock(&m_happening);
70
//
71
// singlelock.lock(class ::time(dwMillis));
72
//
73
// if (pstatus != nullptr)
74
// {
75
//
76
// *pstatus = m_status;
77
//
78
// }
79
//
80
// m_hresult = m_operation->ErrorCode.Value;
81
//
82
// if(m_status == ::winrt::Windows::Foundation::AsyncStatus::Completed)
83
// {
84
//
85
// return m_operation->GetResults();
86
//
87
// }
88
// else
89
// {
90
//
91
// T t;
92
//
93
// waiter_null_result(t);
94
//
95
// return t;
96
//
97
// }
98
//
99
// }
100
//
101
//
102
// template < typename PRED >
103
// void wait(PRED pred,::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
104
// {
105
//
106
// pred(wait(dwMillis, pstatus));
107
//
108
// }
109
//
110
//
111
//};
112
//
113
//
114
//template < typename T, typename T2 >
115
//class waiter_for_Windows_Foundation_IAsyncOperationWithProgress sealed
116
//{
117
//private:
118
//
119
//
120
// manual_reset_happening m_happening;
121
// ::winrt::Windows::Foundation::IAsyncOperationWithProgress < T, T2 > m_operation;
122
// ::winrt::Windows::Foundation::AsyncStatus m_status;
123
// T m_result;
124
//
125
//
126
//public:
127
//
128
//
129
// // waiter_for_Windows_Foundation_IAsyncOperationWithProgress(::winrt::Windows::Foundation::IAsyncOperationWithProgress < T, T2 > ^ operation, CallbackContext callbackcontext = CallbackContext::Any)
130
// waiter_for_Windows_Foundation_IAsyncOperationWithProgress(::winrt::Windows::Foundation::IAsyncOperationWithProgress < T, T2 > operation)
131
// {
132
//
133
// m_operation = operation;
134
//
135
// m_operation->Completed = ::winrt::Windows::Foundation::AsyncOperationWithProgressCompletedHandler < T, T2 >([this](::winrt::Windows::Foundation::IAsyncOperationWithProgress < T, T2 > operation, ::winrt::Windows::Foundation::AsyncStatus status)
136
// {
137
//
138
// auto pholdThis = this;
139
//
140
// m_status = status;
141
//
142
// m_happening.set_happening();
143
//
144
// });
145
//
146
// }
147
//
148
//
149
// virtual ~waiter_for_Windows_Foundation_IAsyncOperationWithProgress()
150
// {
151
//
152
// }
153
//
154
//
155
// T wait(::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
156
// {
157
//
158
// m_happening.wait(class ::time(dwMillis));
159
//
160
// if (pstatus != nullptr)
161
// *pstatus = m_status;
162
//
163
// if (m_status == ::winrt::Windows::Foundation::AsyncStatus::Completed)
164
// {
165
//
166
// return m_operation->GetResults();
167
//
168
// }
169
// else
170
// {
171
//
172
// T t;
173
//
174
// waiter_null_result(t);
175
//
176
// return t;
177
//
178
// }
179
//
180
// }
181
//
182
//};
183
//
184
//
185
//class waiter_for_Windows_Foundation_IAsyncAction
186
//{
187
//private:
188
//
189
//
190
// manual_reset_happening m_happening;
191
// ::winrt::Windows::Foundation::IAsyncAction m_action;
192
// ::winrt::Windows::Foundation::AsyncStatus m_status;
193
//
194
//
195
//public:
196
//
197
//
198
// waiter_for_Windows_Foundation_IAsyncAction(::winrt::Windows::Foundation::IAsyncAction action)
199
// {
200
//
201
// m_action = action;
202
//
203
// m_action.Completed(::winrt::Windows::Foundation::AsyncActionCompletedHandler([this](::winrt::Windows::Foundation::IAsyncAction action, ::winrt::Windows::Foundation::AsyncStatus status)
204
// {
205
//
206
// auto pholdThis = this;
207
//
208
// m_status = status;
209
//
210
// m_happening.set_happening();
211
//
212
// }));
213
//
214
// if(m_action.Status() != ::winrt::Windows::Foundation::AsyncStatus::Started)
215
// {
216
//
217
// m_status = m_action.Status();
218
//
219
// m_happening.set_happening();
220
//
221
// }
222
//
223
// }
224
//
225
//
226
// ~waiter_for_Windows_Foundation_IAsyncAction()
227
// {
228
//
229
// }
230
//
231
//
232
// void wait(::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
233
// {
234
//
235
// auto pholdThis = this;
236
//
237
// m_happening.wait(::integral_millisecond(dwMillis));
238
//
239
// if(pstatus != nullptr)
240
// *pstatus = m_status;
241
//
242
// }
243
//
244
//
245
//};
246
//
247
//
248
//template < typename T, typename PRED >
249
//void fork_then(::particle * pparticle, ::winrt::Windows::Foundation::IAsyncOperation < T > operation, PRED pred, ::u32 dwMillis = U32_INFINITE_TIMEOUT)
250
//{
251
//
252
// pparticle->fork([=]()
253
// {
254
//
255
// auto pwaiter = waiter_for_Windows_Foundation_IAsyncOperation < T >(operation);
256
//
257
// pwaiter.wait(pred, dwMillis);
258
//
259
// });
260
//
261
//}
262
//
263
//
264
//template < typename T, typename PRED >
265
//inline void wait_then(::winrt::Windows::Foundation::IAsyncOperation < T > operation, PRED pred, ::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
266
//{
267
//
268
// auto waiter = waiter_for_Windows_Foundation_IAsyncOperation < T >(operation);
269
//
270
// waiter.wait(pred, dwMillis, pstatus);
271
//
272
//}
273
//
274
//
275
//template < typename T >
276
//inline T wait(::winrt::Windows::Foundation::IAsyncOperation < T > operation, ::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
277
//{
278
//
279
// auto pwaiter = waiter_for_Windows_Foundation_IAsyncOperation < T >(operation);
280
//
281
// return pwaiter->wait(dwMillis, pstatus);
282
//
283
//}
284
//
285
//
286
//template < typename T, typename T2 >
287
//inline T wait(::winrt::Windows::Foundation::IAsyncOperationWithProgress < T, T2 > operation, ::u32 dwMillis = U32_INFINITE_TIMEOUT, ::winrt::Windows::Foundation::AsyncStatus * pstatus = nullptr)
288
//{
289
//
290
// auto waiter = waiter_for_Windows_Foundation_IAsyncOperationWithProgress < T, T2 > (operation);
291
//
292
// return waiter.wait(dwMillis, pstatus);
293
//
294
//}
295
//
296
//
297
//inline ::winrt::Windows::Foundation::AsyncStatus wait(::winrt::Windows::Foundation::IAsyncAction action, ::u32 dwMillis = U32_INFINITE_TIMEOUT)
298
//{
299
//
300
// ::winrt::Windows::Foundation::AsyncStatus status = ::winrt::Windows::Foundation::AsyncStatus::Canceled; // for time out
301
//
302
// auto waiter = waiter_for_Windows_Foundation_IAsyncAction (action);
303
//
304
// waiter.wait(dwMillis, &status);
305
//
306
// return status;
307
//
308
//}
309
//
310
//
311
//
operating_system
universal_windows
parallelization_winrt.h
Generated by
1.17.0