annotate gcc/ada/libgnarl/s-osinte__mingw.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . O S _ I N T E R F A C E --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1991-2017, Florida State University --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
10 -- Copyright (C) 1995-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
11 -- --
kono
parents:
diff changeset
12 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
13 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
17 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
18 -- --
kono
parents:
diff changeset
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
20 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
21 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
22 -- --
kono
parents:
diff changeset
23 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
24 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
26 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
27 -- --
kono
parents:
diff changeset
28 -- GNARL was developed by the GNARL team at Florida State University. --
kono
parents:
diff changeset
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
30 -- --
kono
parents:
diff changeset
31 ------------------------------------------------------------------------------
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 -- This is a NT (native) version of this package
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 -- This package encapsulates all direct interfaces to OS services
kono
parents:
diff changeset
36 -- that are needed by the tasking run-time (libgnarl). For non tasking
kono
parents:
diff changeset
37 -- oriented services consider declaring them into system-win32.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 -- PLEASE DO NOT add any with-clauses to this package or remove the pragma
kono
parents:
diff changeset
40 -- Preelaborate. This package is designed to be a bottom-level (leaf) package.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 with Ada.Unchecked_Conversion;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 with Interfaces.C;
kono
parents:
diff changeset
45 with Interfaces.C.Strings;
kono
parents:
diff changeset
46 with System.Win32;
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 package System.OS_Interface is
kono
parents:
diff changeset
49 pragma Preelaborate;
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 pragma Linker_Options ("-mthreads");
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 subtype int is Interfaces.C.int;
kono
parents:
diff changeset
54 subtype long is Interfaces.C.long;
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 subtype LARGE_INTEGER is System.Win32.LARGE_INTEGER;
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 -------------------
kono
parents:
diff changeset
59 -- General Types --
kono
parents:
diff changeset
60 -------------------
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 subtype PSZ is Interfaces.C.Strings.chars_ptr;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 Null_Void : constant Win32.PVOID := System.Null_Address;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 -------------------------
kono
parents:
diff changeset
67 -- Handles for objects --
kono
parents:
diff changeset
68 -------------------------
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 subtype Thread_Id is Win32.HANDLE;
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 -----------
kono
parents:
diff changeset
73 -- Errno --
kono
parents:
diff changeset
74 -----------
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 NO_ERROR : constant := 0;
kono
parents:
diff changeset
77 FUNC_ERR : constant := -1;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 -------------
kono
parents:
diff changeset
80 -- Signals --
kono
parents:
diff changeset
81 -------------
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 Max_Interrupt : constant := 31;
kono
parents:
diff changeset
84 type Signal is new int range 0 .. Max_Interrupt;
kono
parents:
diff changeset
85 for Signal'Size use int'Size;
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 SIGINT : constant := 2; -- interrupt (Ctrl-C)
kono
parents:
diff changeset
88 SIGILL : constant := 4; -- illegal instruction (not reset)
kono
parents:
diff changeset
89 SIGFPE : constant := 8; -- floating point exception
kono
parents:
diff changeset
90 SIGSEGV : constant := 11; -- segmentation violation
kono
parents:
diff changeset
91 SIGTERM : constant := 15; -- software termination signal from kill
kono
parents:
diff changeset
92 SIGBREAK : constant := 21; -- break (Ctrl-Break)
kono
parents:
diff changeset
93 SIGABRT : constant := 22; -- used by abort, replace SIGIOT in the future
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 type sigset_t is private;
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 type isr_address is access procedure (sig : int);
kono
parents:
diff changeset
98 pragma Convention (C, isr_address);
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 function intr_attach (sig : int; handler : isr_address) return long;
kono
parents:
diff changeset
101 pragma Import (C, intr_attach, "signal");
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 Intr_Attach_Reset : constant Boolean := True;
kono
parents:
diff changeset
104 -- True if intr_attach is reset after an interrupt handler is called
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 procedure kill (sig : Signal);
kono
parents:
diff changeset
107 pragma Import (C, kill, "raise");
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 ------------
kono
parents:
diff changeset
110 -- Clock --
kono
parents:
diff changeset
111 ------------
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 procedure QueryPerformanceFrequency
kono
parents:
diff changeset
114 (lpPerformanceFreq : access LARGE_INTEGER);
kono
parents:
diff changeset
115 pragma Import
kono
parents:
diff changeset
116 (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency");
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 -- According to the spec, on XP and later than function cannot fail,
kono
parents:
diff changeset
119 -- so we ignore the return value and import it as a procedure.
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 -------------
kono
parents:
diff changeset
122 -- Threads --
kono
parents:
diff changeset
123 -------------
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 type Thread_Body is access
kono
parents:
diff changeset
126 function (arg : System.Address) return System.Address;
kono
parents:
diff changeset
127 pragma Convention (C, Thread_Body);
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 function Thread_Body_Access is new
kono
parents:
diff changeset
130 Ada.Unchecked_Conversion (System.Address, Thread_Body);
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 procedure SwitchToThread;
kono
parents:
diff changeset
133 pragma Import (Stdcall, SwitchToThread, "SwitchToThread");
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 function GetThreadTimes
kono
parents:
diff changeset
136 (hThread : Win32.HANDLE;
kono
parents:
diff changeset
137 lpCreationTime : access Long_Long_Integer;
kono
parents:
diff changeset
138 lpExitTime : access Long_Long_Integer;
kono
parents:
diff changeset
139 lpKernelTime : access Long_Long_Integer;
kono
parents:
diff changeset
140 lpUserTime : access Long_Long_Integer) return Win32.BOOL;
kono
parents:
diff changeset
141 pragma Import (Stdcall, GetThreadTimes, "GetThreadTimes");
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 -----------------------
kono
parents:
diff changeset
144 -- Critical sections --
kono
parents:
diff changeset
145 -----------------------
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 type CRITICAL_SECTION is private;
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 -------------------------------------------------------------
kono
parents:
diff changeset
150 -- Thread Creation, Activation, Suspension And Termination --
kono
parents:
diff changeset
151 -------------------------------------------------------------
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 type PTHREAD_START_ROUTINE is access function
kono
parents:
diff changeset
154 (pThreadParameter : Win32.PVOID) return Win32.DWORD;
kono
parents:
diff changeset
155 pragma Convention (Stdcall, PTHREAD_START_ROUTINE);
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 function To_PTHREAD_START_ROUTINE is new
kono
parents:
diff changeset
158 Ada.Unchecked_Conversion (System.Address, PTHREAD_START_ROUTINE);
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 function CreateThread
kono
parents:
diff changeset
161 (pThreadAttributes : access Win32.SECURITY_ATTRIBUTES;
kono
parents:
diff changeset
162 dwStackSize : Win32.DWORD;
kono
parents:
diff changeset
163 pStartAddress : PTHREAD_START_ROUTINE;
kono
parents:
diff changeset
164 pParameter : Win32.PVOID;
kono
parents:
diff changeset
165 dwCreationFlags : Win32.DWORD;
kono
parents:
diff changeset
166 pThreadId : access Win32.DWORD) return Win32.HANDLE;
kono
parents:
diff changeset
167 pragma Import (Stdcall, CreateThread, "CreateThread");
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 function BeginThreadEx
kono
parents:
diff changeset
170 (pThreadAttributes : access Win32.SECURITY_ATTRIBUTES;
kono
parents:
diff changeset
171 dwStackSize : Win32.DWORD;
kono
parents:
diff changeset
172 pStartAddress : PTHREAD_START_ROUTINE;
kono
parents:
diff changeset
173 pParameter : Win32.PVOID;
kono
parents:
diff changeset
174 dwCreationFlags : Win32.DWORD;
kono
parents:
diff changeset
175 pThreadId : not null access Win32.DWORD) return Win32.HANDLE;
kono
parents:
diff changeset
176 pragma Import (C, BeginThreadEx, "_beginthreadex");
kono
parents:
diff changeset
177
kono
parents:
diff changeset
178 Debug_Process : constant := 16#00000001#;
kono
parents:
diff changeset
179 Debug_Only_This_Process : constant := 16#00000002#;
kono
parents:
diff changeset
180 Create_Suspended : constant := 16#00000004#;
kono
parents:
diff changeset
181 Detached_Process : constant := 16#00000008#;
kono
parents:
diff changeset
182 Create_New_Console : constant := 16#00000010#;
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 Create_New_Process_Group : constant := 16#00000200#;
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 Create_No_window : constant := 16#08000000#;
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 Profile_User : constant := 16#10000000#;
kono
parents:
diff changeset
189 Profile_Kernel : constant := 16#20000000#;
kono
parents:
diff changeset
190 Profile_Server : constant := 16#40000000#;
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 Stack_Size_Param_Is_A_Reservation : constant := 16#00010000#;
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 function GetExitCodeThread
kono
parents:
diff changeset
195 (hThread : Win32.HANDLE;
kono
parents:
diff changeset
196 pExitCode : not null access Win32.DWORD) return Win32.BOOL;
kono
parents:
diff changeset
197 pragma Import (Stdcall, GetExitCodeThread, "GetExitCodeThread");
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 function ResumeThread (hThread : Win32.HANDLE) return Win32.DWORD;
kono
parents:
diff changeset
200 pragma Import (Stdcall, ResumeThread, "ResumeThread");
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 function SuspendThread (hThread : Win32.HANDLE) return Win32.DWORD;
kono
parents:
diff changeset
203 pragma Import (Stdcall, SuspendThread, "SuspendThread");
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 procedure ExitThread (dwExitCode : Win32.DWORD);
kono
parents:
diff changeset
206 pragma Import (Stdcall, ExitThread, "ExitThread");
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 procedure EndThreadEx (dwExitCode : Win32.DWORD);
kono
parents:
diff changeset
209 pragma Import (C, EndThreadEx, "_endthreadex");
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 function TerminateThread
kono
parents:
diff changeset
212 (hThread : Win32.HANDLE;
kono
parents:
diff changeset
213 dwExitCode : Win32.DWORD) return Win32.BOOL;
kono
parents:
diff changeset
214 pragma Import (Stdcall, TerminateThread, "TerminateThread");
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 function GetCurrentThread return Win32.HANDLE;
kono
parents:
diff changeset
217 pragma Import (Stdcall, GetCurrentThread, "GetCurrentThread");
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 function GetCurrentProcess return Win32.HANDLE;
kono
parents:
diff changeset
220 pragma Import (Stdcall, GetCurrentProcess, "GetCurrentProcess");
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 function GetCurrentThreadId return Win32.DWORD;
kono
parents:
diff changeset
223 pragma Import (Stdcall, GetCurrentThreadId, "GetCurrentThreadId");
kono
parents:
diff changeset
224
kono
parents:
diff changeset
225 function TlsAlloc return Win32.DWORD;
kono
parents:
diff changeset
226 pragma Import (Stdcall, TlsAlloc, "TlsAlloc");
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 function TlsGetValue (dwTlsIndex : Win32.DWORD) return Win32.PVOID;
kono
parents:
diff changeset
229 pragma Import (Stdcall, TlsGetValue, "TlsGetValue");
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 function TlsSetValue
kono
parents:
diff changeset
232 (dwTlsIndex : Win32.DWORD; pTlsValue : Win32.PVOID) return Win32.BOOL;
kono
parents:
diff changeset
233 pragma Import (Stdcall, TlsSetValue, "TlsSetValue");
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 function TlsFree (dwTlsIndex : Win32.DWORD) return Win32.BOOL;
kono
parents:
diff changeset
236 pragma Import (Stdcall, TlsFree, "TlsFree");
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 TLS_Nothing : constant := Win32.DWORD'Last;
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 procedure ExitProcess (uExitCode : Interfaces.C.unsigned);
kono
parents:
diff changeset
241 pragma Import (Stdcall, ExitProcess, "ExitProcess");
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 function WaitForSingleObject
kono
parents:
diff changeset
244 (hHandle : Win32.HANDLE;
kono
parents:
diff changeset
245 dwMilliseconds : Win32.DWORD) return Win32.DWORD;
kono
parents:
diff changeset
246 pragma Import (Stdcall, WaitForSingleObject, "WaitForSingleObject");
kono
parents:
diff changeset
247
kono
parents:
diff changeset
248 function WaitForSingleObjectEx
kono
parents:
diff changeset
249 (hHandle : Win32.HANDLE;
kono
parents:
diff changeset
250 dwMilliseconds : Win32.DWORD;
kono
parents:
diff changeset
251 fAlertable : Win32.BOOL) return Win32.DWORD;
kono
parents:
diff changeset
252 pragma Import (Stdcall, WaitForSingleObjectEx, "WaitForSingleObjectEx");
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 Wait_Infinite : constant := Win32.DWORD'Last;
kono
parents:
diff changeset
255 WAIT_TIMEOUT : constant := 16#0000_0102#;
kono
parents:
diff changeset
256 WAIT_FAILED : constant := 16#FFFF_FFFF#;
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 ------------------------------------
kono
parents:
diff changeset
259 -- Semaphores, Events and Mutexes --
kono
parents:
diff changeset
260 ------------------------------------
kono
parents:
diff changeset
261
kono
parents:
diff changeset
262 function CreateSemaphore
kono
parents:
diff changeset
263 (pSemaphoreAttributes : access Win32.SECURITY_ATTRIBUTES;
kono
parents:
diff changeset
264 lInitialCount : Interfaces.C.long;
kono
parents:
diff changeset
265 lMaximumCount : Interfaces.C.long;
kono
parents:
diff changeset
266 pName : PSZ) return Win32.HANDLE;
kono
parents:
diff changeset
267 pragma Import (Stdcall, CreateSemaphore, "CreateSemaphoreA");
kono
parents:
diff changeset
268
kono
parents:
diff changeset
269 function OpenSemaphore
kono
parents:
diff changeset
270 (dwDesiredAccess : Win32.DWORD;
kono
parents:
diff changeset
271 bInheritHandle : Win32.BOOL;
kono
parents:
diff changeset
272 pName : PSZ) return Win32.HANDLE;
kono
parents:
diff changeset
273 pragma Import (Stdcall, OpenSemaphore, "OpenSemaphoreA");
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 function ReleaseSemaphore
kono
parents:
diff changeset
276 (hSemaphore : Win32.HANDLE;
kono
parents:
diff changeset
277 lReleaseCount : Interfaces.C.long;
kono
parents:
diff changeset
278 pPreviousCount : access Win32.LONG) return Win32.BOOL;
kono
parents:
diff changeset
279 pragma Import (Stdcall, ReleaseSemaphore, "ReleaseSemaphore");
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 function CreateEvent
kono
parents:
diff changeset
282 (pEventAttributes : access Win32.SECURITY_ATTRIBUTES;
kono
parents:
diff changeset
283 bManualReset : Win32.BOOL;
kono
parents:
diff changeset
284 bInitialState : Win32.BOOL;
kono
parents:
diff changeset
285 pName : PSZ) return Win32.HANDLE;
kono
parents:
diff changeset
286 pragma Import (Stdcall, CreateEvent, "CreateEventA");
kono
parents:
diff changeset
287
kono
parents:
diff changeset
288 function OpenEvent
kono
parents:
diff changeset
289 (dwDesiredAccess : Win32.DWORD;
kono
parents:
diff changeset
290 bInheritHandle : Win32.BOOL;
kono
parents:
diff changeset
291 pName : PSZ) return Win32.HANDLE;
kono
parents:
diff changeset
292 pragma Import (Stdcall, OpenEvent, "OpenEventA");
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 function SetEvent (hEvent : Win32.HANDLE) return Win32.BOOL;
kono
parents:
diff changeset
295 pragma Import (Stdcall, SetEvent, "SetEvent");
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 function ResetEvent (hEvent : Win32.HANDLE) return Win32.BOOL;
kono
parents:
diff changeset
298 pragma Import (Stdcall, ResetEvent, "ResetEvent");
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 function PulseEvent (hEvent : Win32.HANDLE) return Win32.BOOL;
kono
parents:
diff changeset
301 pragma Import (Stdcall, PulseEvent, "PulseEvent");
kono
parents:
diff changeset
302
kono
parents:
diff changeset
303 function CreateMutex
kono
parents:
diff changeset
304 (pMutexAttributes : access Win32.SECURITY_ATTRIBUTES;
kono
parents:
diff changeset
305 bInitialOwner : Win32.BOOL;
kono
parents:
diff changeset
306 pName : PSZ) return Win32.HANDLE;
kono
parents:
diff changeset
307 pragma Import (Stdcall, CreateMutex, "CreateMutexA");
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 function OpenMutex
kono
parents:
diff changeset
310 (dwDesiredAccess : Win32.DWORD;
kono
parents:
diff changeset
311 bInheritHandle : Win32.BOOL;
kono
parents:
diff changeset
312 pName : PSZ) return Win32.HANDLE;
kono
parents:
diff changeset
313 pragma Import (Stdcall, OpenMutex, "OpenMutexA");
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 function ReleaseMutex (hMutex : Win32.HANDLE) return Win32.BOOL;
kono
parents:
diff changeset
316 pragma Import (Stdcall, ReleaseMutex, "ReleaseMutex");
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 ---------------------------------------------------
kono
parents:
diff changeset
319 -- Accessing properties of Threads and Processes --
kono
parents:
diff changeset
320 ---------------------------------------------------
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 -----------------
kono
parents:
diff changeset
323 -- Priorities --
kono
parents:
diff changeset
324 -----------------
kono
parents:
diff changeset
325
kono
parents:
diff changeset
326 function SetThreadPriority
kono
parents:
diff changeset
327 (hThread : Win32.HANDLE;
kono
parents:
diff changeset
328 nPriority : Interfaces.C.int) return Win32.BOOL;
kono
parents:
diff changeset
329 pragma Import (Stdcall, SetThreadPriority, "SetThreadPriority");
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 function GetThreadPriority (hThread : Win32.HANDLE) return Interfaces.C.int;
kono
parents:
diff changeset
332 pragma Import (Stdcall, GetThreadPriority, "GetThreadPriority");
kono
parents:
diff changeset
333
kono
parents:
diff changeset
334 function SetPriorityClass
kono
parents:
diff changeset
335 (hProcess : Win32.HANDLE;
kono
parents:
diff changeset
336 dwPriorityClass : Win32.DWORD) return Win32.BOOL;
kono
parents:
diff changeset
337 pragma Import (Stdcall, SetPriorityClass, "SetPriorityClass");
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 procedure SetThreadPriorityBoost
kono
parents:
diff changeset
340 (hThread : Win32.HANDLE;
kono
parents:
diff changeset
341 DisablePriorityBoost : Win32.BOOL);
kono
parents:
diff changeset
342 pragma Import (Stdcall, SetThreadPriorityBoost, "SetThreadPriorityBoost");
kono
parents:
diff changeset
343
kono
parents:
diff changeset
344 Normal_Priority_Class : constant := 16#00000020#;
kono
parents:
diff changeset
345 Idle_Priority_Class : constant := 16#00000040#;
kono
parents:
diff changeset
346 High_Priority_Class : constant := 16#00000080#;
kono
parents:
diff changeset
347 Realtime_Priority_Class : constant := 16#00000100#;
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 Thread_Priority_Idle : constant := -15;
kono
parents:
diff changeset
350 Thread_Priority_Lowest : constant := -2;
kono
parents:
diff changeset
351 Thread_Priority_Below_Normal : constant := -1;
kono
parents:
diff changeset
352 Thread_Priority_Normal : constant := 0;
kono
parents:
diff changeset
353 Thread_Priority_Above_Normal : constant := 1;
kono
parents:
diff changeset
354 Thread_Priority_Highest : constant := 2;
kono
parents:
diff changeset
355 Thread_Priority_Time_Critical : constant := 15;
kono
parents:
diff changeset
356 Thread_Priority_Error_Return : constant := Interfaces.C.long'Last;
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 private
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 type sigset_t is new Interfaces.C.unsigned_long;
kono
parents:
diff changeset
361
kono
parents:
diff changeset
362 type CRITICAL_SECTION is record
kono
parents:
diff changeset
363 DebugInfo : System.Address;
kono
parents:
diff changeset
364
kono
parents:
diff changeset
365 LockCount : Long_Integer;
kono
parents:
diff changeset
366 RecursionCount : Long_Integer;
kono
parents:
diff changeset
367 OwningThread : Win32.HANDLE;
kono
parents:
diff changeset
368 -- The above three fields control entering and exiting the critical
kono
parents:
diff changeset
369 -- section for the resource.
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 LockSemaphore : Win32.HANDLE;
kono
parents:
diff changeset
372 SpinCount : Win32.DWORD;
kono
parents:
diff changeset
373 end record;
kono
parents:
diff changeset
374
kono
parents:
diff changeset
375 end System.OS_Interface;