|
GRPC Core
9.0.0
|
#include <grpc/support/port_platform.h>#include "src/core/lib/surface/completion_queue.h"#include <inttypes.h>#include <stdio.h>#include <string.h>#include <grpc/support/alloc.h>#include <grpc/support/atm.h>#include <grpc/support/log.h>#include <grpc/support/string_util.h>#include <grpc/support/time.h>#include "src/core/lib/debug/stats.h"#include "src/core/lib/gpr/spinlock.h"#include "src/core/lib/gpr/tls.h"#include "src/core/lib/gprpp/atomic.h"#include "src/core/lib/iomgr/executor.h"#include "src/core/lib/iomgr/pollset.h"#include "src/core/lib/iomgr/timer.h"#include "src/core/lib/profiling/timers.h"#include "src/core/lib/surface/api_trace.h"#include "src/core/lib/surface/call.h"#include "src/core/lib/surface/event_string.h"Data Structures | |
| struct | cq_vtable |
| struct | grpc_completion_queue |
| struct | cq_is_finished_arg |
| class | ExecCtxNext |
| class | ExecCtxPluck |
Macros | |
| #define | DATA_FROM_CQ(cq) ((void*)(cq + 1)) |
| #define | POLLSET_FROM_CQ(cq) ((grpc_pollset*)(cq->vtable->data_size + (char*)DATA_FROM_CQ(cq))) |
| #define | GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) |
Variables | |
| grpc_core::TraceFlag | grpc_trace_operation_failures (false, "op_failure") |
| grpc_core::DebugOnlyTraceFlag | grpc_trace_pending_tags (false, "pending_tags") |
| grpc_core::DebugOnlyTraceFlag | grpc_trace_cq_refcount (false, "cq_refcount") |
| grpc_core::TraceFlag | grpc_cq_pluck_trace (false, "queue_pluck") |
| #define DATA_FROM_CQ | ( | cq | ) | ((void*)(cq + 1)) |
| #define GRPC_SURFACE_TRACE_RETURNED_EVENT | ( | cq, | |
| event | |||
| ) |
| #define POLLSET_FROM_CQ | ( | cq | ) | ((grpc_pollset*)(cq->vtable->data_size + (char*)DATA_FROM_CQ(cq))) |
| grpc_completion_queue* grpc_completion_queue_create_internal | ( | grpc_cq_completion_type | completion_type, |
| grpc_cq_polling_type | polling_type, | ||
| grpc_experimental_completion_queue_functor * | shutdown_callback | ||
| ) |
| void grpc_completion_queue_destroy | ( | grpc_completion_queue * | cq | ) |
Destroy a completion queue.
The caller must ensure that the queue is drained and no threads are executing grpc_completion_queue_next
| grpc_event grpc_completion_queue_next | ( | grpc_completion_queue * | cq, |
| gpr_timespec | deadline, | ||
| void * | reserved | ||
| ) |
Blocks until an event is available, the completion queue is being shut down, or deadline is reached.
Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout, otherwise a grpc_event describing the event that occurred.
Callers must not call grpc_completion_queue_next and grpc_completion_queue_pluck simultaneously on the same completion queue.
| grpc_event grpc_completion_queue_pluck | ( | grpc_completion_queue * | cq, |
| void * | tag, | ||
| gpr_timespec | deadline, | ||
| void * | reserved | ||
| ) |
Blocks until an event with tag 'tag' is available, the completion queue is being shutdown or deadline is reached.
Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout, otherwise a grpc_event describing the event that occurred.
Callers must not call grpc_completion_queue_next and grpc_completion_queue_pluck simultaneously on the same completion queue.
Completion queues support a maximum of GRPC_MAX_COMPLETION_QUEUE_PLUCKERS concurrently executing plucks at any time.
| void grpc_completion_queue_shutdown | ( | grpc_completion_queue * | cq | ) |
Begin destruction of a completion queue.
Once all possible events are drained then grpc_completion_queue_next will start to produce GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call grpc_completion_queue_destroy.
After calling this function applications should ensure that no NEW work is added to be published on this completion queue.
| int grpc_completion_queue_thread_local_cache_flush | ( | grpc_completion_queue * | cq, |
| void ** | tag, | ||
| int * | ok | ||
| ) |
Flushes the thread local cache for cq.
Returns 1 if there was contents in the cache. If there was an event in cq tls cache, its tag is placed in tag, and ok is set to the event success.
| void grpc_completion_queue_thread_local_cache_init | ( | grpc_completion_queue * | cq | ) |
Initializes a thread local cache for cq.
grpc_flush_cq_tls_cache() MUST be called on the same thread, with the same cq.
| bool grpc_cq_begin_op | ( | grpc_completion_queue * | cq, |
| void * | tag | ||
| ) |
| bool grpc_cq_can_listen | ( | grpc_completion_queue * | cq | ) |
| void grpc_cq_end_op | ( | grpc_completion_queue * | cq, |
| void * | tag, | ||
| grpc_error * | error, | ||
| void(*)(void *done_arg, grpc_cq_completion *storage) | done, | ||
| void * | done_arg, | ||
| grpc_cq_completion * | storage, | ||
| bool | internal | ||
| ) |
| void grpc_cq_global_init | ( | ) |
| void grpc_cq_internal_ref | ( | grpc_completion_queue * | cq, |
| const char * | reason, | ||
| const char * | file, | ||
| int | line | ||
| ) |
| void grpc_cq_internal_unref | ( | grpc_completion_queue * | cq, |
| const char * | reason, | ||
| const char * | file, | ||
| int | line | ||
| ) |
| grpc_pollset* grpc_cq_pollset | ( | grpc_completion_queue * | cq | ) |
| grpc_cq_completion_type grpc_get_cq_completion_type | ( | grpc_completion_queue * | cq | ) |
| int grpc_get_cq_poll_num | ( | grpc_completion_queue * | cq | ) |
| grpc_core::TraceFlag grpc_cq_pluck_trace(false, "queue_pluck") | ( | false | , |
| "queue_pluck" | |||
| ) |
| grpc_core::DebugOnlyTraceFlag grpc_trace_cq_refcount(false, "cq_refcount") | ( | false | , |
| "cq_refcount" | |||
| ) |
| grpc_core::TraceFlag grpc_trace_operation_failures(false, "op_failure") | ( | false | , |
| "op_failure" | |||
| ) |
| grpc_core::DebugOnlyTraceFlag grpc_trace_pending_tags(false, "pending_tags") | ( | false | , |
| "pending_tags" | |||
| ) |