Commit | Line | Data |
---|---|---|
3666451e MD |
1 | /* classes: h_files */ |
2 | ||
0527e687 DH |
3 | #ifndef SCM_ISELECT_H |
4 | #define SCM_ISELECT_H | |
3666451e | 5 | |
1d0bde44 | 6 | /* Copyright (C) 1997,1998,2000,2001, 2002 Free Software Foundation, Inc. |
0527e687 | 7 | * |
73be1d9e MV |
8 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. | |
0527e687 | 12 | * |
73be1d9e | 13 | * This library is distributed in the hope that it will be useful, |
3666451e | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
0527e687 | 17 | * |
73be1d9e MV |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | */ | |
0527e687 DH |
22 | |
23 | \f | |
3666451e MD |
24 | |
25 | #include "libguile/__scm.h" | |
26 | ||
bb3b902f JB |
27 | /* Needed for FD_SET on some systems. */ |
28 | #include <sys/types.h> | |
29 | ||
9d4b740b RB |
30 | #if SCM_HAVE_SYS_SELECT_H |
31 | # include <sys/select.h> | |
3666451e MD |
32 | #endif |
33 | ||
9d4b740b | 34 | #if SCM_HAVE_WINSOCK2_H |
b31e9238 | 35 | # include <winsock2.h> |
82893676 MG |
36 | #endif |
37 | ||
3666451e MD |
38 | #ifdef FD_SET |
39 | ||
40 | #define SELECT_TYPE fd_set | |
41 | #define SELECT_SET_SIZE FD_SETSIZE | |
42 | ||
43 | #else /* no FD_SET */ | |
44 | ||
45 | /* Define the macros to access a single-int bitmap of descriptors. */ | |
46 | #define SELECT_SET_SIZE 32 | |
47 | #define SELECT_TYPE int | |
48 | #define FD_SET(n, p) (*(p) |= (1 << (n))) | |
49 | #define FD_CLR(n, p) (*(p) &= ~(1 << (n))) | |
50 | #define FD_ISSET(n, p) (*(p) & (1 << (n))) | |
51 | #define FD_ZERO(p) (*(p) = 0) | |
52 | ||
53 | #endif /* no FD_SET */ | |
54 | ||
33b001fd MV |
55 | SCM_API int scm_internal_select (int fds, |
56 | SELECT_TYPE *rfds, | |
57 | SELECT_TYPE *wfds, | |
58 | SELECT_TYPE *efds, | |
59 | struct timeval *timeout); | |
87b21c09 | 60 | |
9d4b740b | 61 | #if SCM_USE_COOP_THREADS |
87b21c09 | 62 | |
33b001fd | 63 | SCM_API int scm_I_am_dead; |
87b21c09 | 64 | |
33b001fd | 65 | SCM_API void scm_error_revive_threads (void); |
3666451e | 66 | |
b31e9238 | 67 | #endif /* SCM_USE_COOP_THREADS */ |
1d0bde44 MV |
68 | |
69 | SCM_API void scm_init_iselect (void); | |
6d8d2deb | 70 | |
0527e687 | 71 | #endif /* SCM_ISELECT_H */ |
89e00824 ML |
72 | |
73 | /* | |
74 | Local Variables: | |
75 | c-file-style: "gnu" | |
76 | End: | |
77 | */ |