Debian Codegraph @

gcc/ada/libgnat/g-sopowa.adb

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T . S O C K E T S . P O L L . W A I T --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2020-2025, AdaCore --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- Wait implementation on top of native poll call
33 --
34 -- This submodule can be used on systems where poll system call is natively
35 -- supported. Microsoft Windows supports WSAPoll system call from Vista
36 -- version and this submodule can be used on such Windows versions too, the
37 -- System.OS_Constants.Poll_Linkname constant defines appropriate link name
38 -- for Windows. But we do not use WSAPoll in GNAT.Sockets.Poll implementation
39 -- for now because it is much slower than select system call, at least in
40 -- Windows version 10.0.18363.1016.
41
42 separate (GNAT.Sockets.Poll)
43
44 procedure Wait
45 (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer)
46 is
47
48 function Poll
49 (Fds : Poll_Set;
50 Nfds : nfds_t;
51 Timeout : Interfaces.C.int) return Integer
52 with Import, Convention => Stdcall, External_Name => SOC.Poll_Linkname;
53
54 begin
55 Result := Poll (Fds.Fds, nfds_t (Fds.Length), Timeout);
56 end Wait;