diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-10-11 15:21:11 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-10-11 15:21:11 +0000 |
commit | ee182a0b2995f562637f8c97f4591f6d55c4a0fb (patch) | |
tree | 21178baa04b3afc25f90a3fc8e7e11f8f583b7bb /src/microhttpd/mhd_itc_types.h | |
parent | ec820265a0b7f40fda6be51fbd7b8b0264aab4e9 (diff) | |
download | libmicrohttpd-ee182a0b2995f562637f8c97f4591f6d55c4a0fb.tar.gz libmicrohttpd-ee182a0b2995f562637f8c97f4591f6d55c4a0fb.zip |
Use MHD_itc_activate_ macro for ITC signaling, move ITC types to separate
header.
Separate header allow exclusion of heavy headers in internal.h, which is
included by most source files.
Fixed checking success of write() to eventFD by comparing result to 1.
Fixed error when trying to signal on fully filled ITC (ITC is already in
activated (signaled) state and those conditions are not an error).
EventFD is signaled now by macro, not a function.
Diffstat (limited to 'src/microhttpd/mhd_itc_types.h')
-rw-r--r-- | src/microhttpd/mhd_itc_types.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_itc_types.h b/src/microhttpd/mhd_itc_types.h new file mode 100644 index 00000000..f91e9383 --- /dev/null +++ b/src/microhttpd/mhd_itc_types.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2016 Karlson2k (Evgeny Grin), Christian Grothoff | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file microhttpd/mhd_itc_types.h | ||
23 | * @brief Types for platform-independent inter-thread communication | ||
24 | * @author Karlson2k (Evgeny Grin) | ||
25 | * @author Christian Grothoff | ||
26 | * | ||
27 | * Provides basic types for inter-thread communication. | ||
28 | * Designed to be included by other headers. | ||
29 | */ | ||
30 | #ifndef MHD_ITC_TYPES_H | ||
31 | #define MHD_ITC_TYPES_H 1 | ||
32 | #include "mhd_options.h" | ||
33 | |||
34 | /* Force socketpair on native W32 */ | ||
35 | #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(_MHD_ITC_SOCKETPAIR) | ||
36 | #error _MHD_ITC_SOCKETPAIR is not defined on naitive W32 platform | ||
37 | #endif /* _WIN32 && !__CYGWIN__ && !_MHD_ITC_SOCKETPAIR */ | ||
38 | |||
39 | #if defined(_MHD_ITC_EVENTFD) | ||
40 | /* **************** Optimized GNU/Linux ITC implementation by eventfd ********** */ | ||
41 | |||
42 | /** | ||
43 | * Data type for a MHD ITC. | ||
44 | */ | ||
45 | typedef int MHD_itc_; | ||
46 | |||
47 | #elif defined(_MHD_ITC_PIPE) | ||
48 | /* **************** Standard UNIX ITC implementation by pipe ********** */ | ||
49 | |||
50 | /** | ||
51 | * Base data type for a MHD ITC. | ||
52 | */ | ||
53 | struct MHD_Itc | ||
54 | { | ||
55 | int fd[2]; | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * Data type for a MHD ITC. | ||
60 | */ | ||
61 | typedef struct MHD_Itc MHD_itc_; | ||
62 | |||
63 | #elif defined(_MHD_ITC_SOCKETPAIR) | ||
64 | /* **************** ITC implementation by socket pair ********** */ | ||
65 | |||
66 | #include "mhd_sockets.h" | ||
67 | |||
68 | /** | ||
69 | * Base data type for a MHD ITC. | ||
70 | */ | ||
71 | struct MHD_Itc | ||
72 | { | ||
73 | MHD_socket sk[2]; | ||
74 | }; | ||
75 | |||
76 | /** | ||
77 | * Data type for a MHD ITC. | ||
78 | */ | ||
79 | typedef struct MHD_Itc MHD_itc_; | ||
80 | |||
81 | #endif /* _MHD_ITC_SOCKETPAIR */ | ||
82 | |||
83 | #endif /* ! MHD_ITC_TYPES_H */ | ||