| 1 |
/* |
| 2 |
* Copyright 2022 Nikolay Sivov for CodeWeavers |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2.1 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifdef __WIDL__ |
| 20 |
#pragma winrt ns_prefix |
| 21 |
#endif |
| 22 |
|
| 23 |
import "inspectable.idl"; |
| 24 |
import "asyncinfo.idl"; |
| 25 |
import "windowscontracts.idl"; |
| 26 |
import "windows.foundation.idl"; |
| 27 |
|
| 28 |
namespace Windows.System.Threading |
| 29 |
{ |
| 30 |
typedef enum WorkItemPriority WorkItemPriority; |
| 31 |
typedef enum WorkItemOptions WorkItemOptions; |
| 32 |
|
| 33 |
runtimeclass ThreadPool; |
| 34 |
|
| 35 |
[ |
| 36 |
contract(Windows.Foundation.UniversalApiContract, 1.0) |
| 37 |
] |
| 38 |
enum WorkItemPriority |
| 39 |
{ |
| 40 |
Low = -1, |
| 41 |
Normal = 0, |
| 42 |
High = 1 |
| 43 |
}; |
| 44 |
|
| 45 |
[ |
| 46 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 47 |
flags |
| 48 |
] |
| 49 |
enum WorkItemOptions |
| 50 |
{ |
| 51 |
None = 0x0, |
| 52 |
TimeSliced = 0x1 |
| 53 |
}; |
| 54 |
|
| 55 |
[ |
| 56 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 57 |
uuid(1d1a8b8b-fa66-414f-9cbd-b65fc99d17fa) |
| 58 |
] |
| 59 |
delegate HRESULT WorkItemHandler([in] Windows.Foundation.IAsyncAction *operation); |
| 60 |
|
| 61 |
[ |
| 62 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 63 |
exclusiveto(Windows.System.Threading.ThreadPool), |
| 64 |
uuid(b6bf67dd-84bd-44f8-ac1c-93ebcb9dba91) |
| 65 |
] |
| 66 |
interface IThreadPoolStatics : IInspectable |
| 67 |
{ |
| 68 |
[overload("RunAsync")] HRESULT RunAsync( |
| 69 |
[in] Windows.System.Threading.WorkItemHandler *handler, |
| 70 |
[out, retval] Windows.Foundation.IAsyncAction **operation |
| 71 |
); |
| 72 |
|
| 73 |
[overload("RunAsync")] HRESULT RunWithPriorityAsync( |
| 74 |
[in] Windows.System.Threading.WorkItemHandler *handler, |
| 75 |
[in] Windows.System.Threading.WorkItemPriority priority, |
| 76 |
[out, retval] Windows.Foundation.IAsyncAction **operation |
| 77 |
); |
| 78 |
|
| 79 |
[overload("RunAsync")] HRESULT RunWithPriorityAndOptionsAsync( |
| 80 |
[in] Windows.System.Threading.WorkItemHandler *handler, |
| 81 |
[in] Windows.System.Threading.WorkItemPriority priority, |
| 82 |
[in] Windows.System.Threading.WorkItemOptions options, |
| 83 |
[out, retval] Windows.Foundation.IAsyncAction **operation |
| 84 |
); |
| 85 |
} |
| 86 |
|
| 87 |
[ |
| 88 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 89 |
marshaling_behavior(agile), |
| 90 |
static(Windows.System.Threading.IThreadPoolStatics, Windows.Foundation.UniversalApiContract, 1.0), |
| 91 |
threading(both) |
| 92 |
] |
| 93 |
runtimeclass ThreadPool |
| 94 |
{ |
| 95 |
} |
| 96 |
} |