aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/ext/grpc/rb_completion_queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ruby/ext/grpc/rb_completion_queue.c')
-rw-r--r--src/ruby/ext/grpc/rb_completion_queue.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c
index 4283c27429..64264f5b15 100644
--- a/src/ruby/ext/grpc/rb_completion_queue.c
+++ b/src/ruby/ext/grpc/rb_completion_queue.c
@@ -30,16 +30,16 @@
/* Used to allow grpc_completion_queue_next call to release the GIL */
typedef struct next_call_stack {
- grpc_completion_queue *cq;
+ grpc_completion_queue* cq;
grpc_event event;
gpr_timespec timeout;
- void *tag;
+ void* tag;
volatile int interrupted;
} next_call_stack;
/* Calls grpc_completion_queue_pluck without holding the ruby GIL */
-static void *grpc_rb_completion_queue_pluck_no_gil(void *param) {
- next_call_stack *const next_call = (next_call_stack *)param;
+static void* grpc_rb_completion_queue_pluck_no_gil(void* param) {
+ next_call_stack* const next_call = (next_call_stack*)param;
gpr_timespec increment = gpr_time_from_millis(20, GPR_TIMESPAN);
gpr_timespec deadline;
do {
@@ -55,7 +55,7 @@ static void *grpc_rb_completion_queue_pluck_no_gil(void *param) {
}
/* Helper function to free a completion queue. */
-void grpc_rb_completion_queue_destroy(grpc_completion_queue *cq) {
+void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq) {
/* Every function that adds an event to a queue also synchronously plucks
that event from the queue, and holds a reference to the Ruby object that
holds the queue, so we only get to this point if all of those functions
@@ -64,15 +64,15 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue *cq) {
grpc_completion_queue_destroy(cq);
}
-static void unblock_func(void *param) {
- next_call_stack *const next_call = (next_call_stack *)param;
+static void unblock_func(void* param) {
+ next_call_stack* const next_call = (next_call_stack*)param;
next_call->interrupted = 1;
}
/* Does the same thing as grpc_completion_queue_pluck, while properly releasing
the GVL and handling interrupts */
-grpc_event rb_completion_queue_pluck(grpc_completion_queue *queue, void *tag,
- gpr_timespec deadline, void *reserved) {
+grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
+ gpr_timespec deadline, void* reserved) {
next_call_stack next_call;
MEMZERO(&next_call, next_call_stack, 1);
next_call.cq = queue;
@@ -91,8 +91,8 @@ grpc_event rb_completion_queue_pluck(grpc_completion_queue *queue, void *tag,
do {
next_call.interrupted = 0;
rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
- (void *)&next_call, unblock_func,
- (void *)&next_call);
+ (void*)&next_call, unblock_func,
+ (void*)&next_call);
/* If an interrupt prevented pluck from returning useful information, then
any plucks that did complete must have timed out */
} while (next_call.interrupted && next_call.event.type == GRPC_QUEUE_TIMEOUT);