diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-08-01 16:15:45 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-08-01 16:21:37 -0700 |
commit | 489df079ae948a4ea695a3e8f27b6e0a43d5daf1 (patch) | |
tree | 2d9db5229d634abffbc331e86df7f97c54e2b1f8 | |
parent | 42ce225d50534f2bd6e24c47963896f096e1cb5f (diff) |
Formalize max pluckers
-rw-r--r-- | include/grpc/grpc.h | 9 | ||||
-rw-r--r-- | src/core/surface/completion_queue.c | 6 |
2 files changed, 10 insertions, 5 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 17906c80f6..d29f71bbe7 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -391,10 +391,17 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, 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_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. */ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, gpr_timespec deadline); +/** Maximum number of outstanding grpc_completion_queue_pluck executions per + completion queue */ +#define GRPC_MAX_COMPLETION_QUEUE_PLUCKERS 6 + /** 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 diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index 732813fed0..6bfccd2a2e 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -45,8 +45,6 @@ #include <grpc/support/atm.h> #include <grpc/support/log.h> -#define MAX_PLUCKERS 4 - typedef struct { grpc_pollset_worker *worker; void *tag; @@ -68,7 +66,7 @@ struct grpc_completion_queue { int shutdown_called; int is_server_cq; int num_pluckers; - plucker pluckers[MAX_PLUCKERS]; + plucker pluckers[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS]; }; grpc_completion_queue *grpc_completion_queue_create(void) { @@ -205,7 +203,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, static void add_plucker(grpc_completion_queue *cc, void *tag, grpc_pollset_worker *worker) { - GPR_ASSERT(cc->num_pluckers != MAX_PLUCKERS); + GPR_ASSERT(cc->num_pluckers != GRPC_MAX_COMPLETION_QUEUE_PLUCKERS); cc->pluckers[cc->num_pluckers].tag = tag; cc->pluckers[cc->num_pluckers].worker = worker; cc->num_pluckers++; |