GRPC Core 0.10.0.0

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pollset.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34 #ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_H
35 #define GRPC_INTERNAL_CORE_IOMGR_POLLSET_H
36
37 #include <grpc/support/port_platform.h>
38 #include <grpc/support/time.h>
39
40 /* A grpc_pollset is a set of file descriptors that a higher level item is
41 interested in. For example:
42 - a server will typically keep a pollset containing all connected channels,
43 so that it can find new calls to service
44 - a completion queue might keep a pollset with an entry for each transport
45 that is servicing a call that it's tracking */
46
47 #ifdef GPR_POSIX_SOCKET
48 #include "src/core/iomgr/pollset_posix.h"
49 #endif
50
51 #ifdef GPR_WIN32
52 #include "src/core/iomgr/pollset_windows.h"
53 #endif
54
55 void grpc_pollset_init(grpc_pollset *pollset);
56 void grpc_pollset_shutdown(grpc_pollset *pollset,
57 void (*shutdown_done)(void *arg),
58 void *shutdown_done_arg);
59 void grpc_pollset_destroy(grpc_pollset *pollset);
60
61 /* Do some work on a pollset.
62 May involve invoking asynchronous callbacks, or actually polling file
63 descriptors.
64 Requires GRPC_POLLSET_MU(pollset) locked.
65 May unlock GRPC_POLLSET_MU(pollset) during its execution.
66
67 Returns true if some work has been done, and false if the deadline
68 got attained. */
69 int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline);
70
71 /* Break one polling thread out of polling work for this pollset.
72 Requires GRPC_POLLSET_MU(pollset) locked. */
73 void grpc_pollset_kick(grpc_pollset *pollset);
74
75 #endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_H */
port_platform.h
time.h
pollset_posix.h
grpc_pollset_work
int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline)
arg
Definition: cmdline.c:47
grpc_pollset
Definition: pollset_posix.h:48
grpc_pollset_init
void grpc_pollset_init(grpc_pollset *pollset)
grpc_pollset_destroy
void grpc_pollset_destroy(grpc_pollset *pollset)
grpc_pollset_shutdown
void grpc_pollset_shutdown(grpc_pollset *pollset, void(*shutdown_done)(void *arg), void *shutdown_done_arg)
gpr_timespec
Definition: time.h:60
grpc_pollset_kick
void grpc_pollset_kick(grpc_pollset *pollset)
pollset_windows.h