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
completion_queue.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_SURFACE_COMPLETION_QUEUE_H
35 #define GRPC_INTERNAL_CORE_SURFACE_COMPLETION_QUEUE_H
36
37 /* Internal API for completion channels */
38
39 #include "src/core/iomgr/pollset.h"
40 #include <grpc/grpc.h>
41
42 typedef struct grpc_cq_completion {
44 void *tag;
47 void (*done)(void *done_arg, struct grpc_cq_completion *c);
48 void *done_arg;
50 gpr_uintptr next;
51 } grpc_cq_completion;
52
53 #ifdef GRPC_CQ_REF_COUNT_DEBUG
54 void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason,
55 const char *file, int line);
56 void grpc_cq_internal_unref(grpc_completion_queue *cc, const char *reason,
57 const char *file, int line);
58 #define GRPC_CQ_INTERNAL_REF(cc, reason) \
59 grpc_cq_internal_ref(cc, reason, __FILE__, __LINE__)
60 #define GRPC_CQ_INTERNAL_UNREF(cc, reason) \
61 grpc_cq_internal_unref(cc, reason, __FILE__, __LINE__)
62 #else
63 void grpc_cq_internal_ref(grpc_completion_queue *cc);
64 void grpc_cq_internal_unref(grpc_completion_queue *cc);
65 #define GRPC_CQ_INTERNAL_REF(cc, reason) grpc_cq_internal_ref(cc)
66 #define GRPC_CQ_INTERNAL_UNREF(cc, reason) grpc_cq_internal_unref(cc)
67 #endif
68
69 /* Flag that an operation is beginning: the completion channel will not finish
70 shutdown until a corrensponding grpc_cq_end_* call is made */
71 void grpc_cq_begin_op(grpc_completion_queue *cc);
72
73 /* Queue a GRPC_OP_COMPLETED operation */
74 void grpc_cq_end_op(grpc_completion_queue *cc, void *tag, int success,
75 void (*done)(void *done_arg, grpc_cq_completion *storage),
76 void *done_arg, grpc_cq_completion *storage);
77
78 grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc);
79
80 void grpc_cq_hack_spin_pollset(grpc_completion_queue *cc);
81
82 void grpc_cq_mark_server_cq(grpc_completion_queue *cc);
83 int grpc_cq_is_server_cq(grpc_completion_queue *cc);
84
85 #endif /* GRPC_INTERNAL_CORE_SURFACE_COMPLETION_QUEUE_H */
grpc_cq_pollset
grpc_pollset * grpc_cq_pollset(grpc_completion_queue *cc)
Definition: completion_queue.c:260
gpr_uintptr
uintptr_t gpr_uintptr
Definition: port_platform.h:314
grpc_cq_completion
struct grpc_cq_completion grpc_cq_completion
pollset.h
grpc_cq_completion
Definition: completion_queue.h:42
grpc_cq_completion::next
gpr_uintptr next
next pointer; low bit is used to indicate success or not
Definition: completion_queue.h:50
grpc_pollset
Definition: pollset_posix.h:48
grpc_cq_hack_spin_pollset
void grpc_cq_hack_spin_pollset(grpc_completion_queue *cc)
Definition: completion_queue.c:264
grpc_cq_completion::done_arg
void * done_arg
Definition: completion_queue.h:48
grpc_cq_completion::done
void(* done)(void *done_arg, struct grpc_cq_completion *c)
done callback - called when this queue element is no longer needed by the completion queue ...
Definition: completion_queue.h:47
grpc_cq_end_op
void grpc_cq_end_op(grpc_completion_queue *cc, void *tag, int success, void(*done)(void *done_arg, grpc_cq_completion *storage), void *done_arg, grpc_cq_completion *storage)
Definition: completion_queue.c:116
grpc_completion_queue
Definition: completion_queue.c:49
grpc_cq_internal_unref
void grpc_cq_internal_unref(grpc_completion_queue *cc)
Definition: completion_queue.c:100
grpc_cq_begin_op
void grpc_cq_begin_op(grpc_completion_queue *cc)
Definition: completion_queue.c:109
grpc_cq_internal_ref
void grpc_cq_internal_ref(grpc_completion_queue *cc)
Definition: completion_queue.c:84
grpc.h
grpc_cq_completion::tag
void * tag
user supplied tag
Definition: completion_queue.h:44
grpc_cq_mark_server_cq
void grpc_cq_mark_server_cq(grpc_completion_queue *cc)
Definition: completion_queue.c:273
grpc_cq_is_server_cq
int grpc_cq_is_server_cq(grpc_completion_queue *cc)
Definition: completion_queue.c:275