|
|
@ -56,20 +56,22 @@ const grpc_completion_queue_attributes kCompletionQueueAttr = { |
|
|
|
}); |
|
|
|
}); |
|
|
|
dispatch_async(gDefaultConcurrentQueue, ^{ |
|
|
|
dispatch_async(gDefaultConcurrentQueue, ^{ |
|
|
|
while (YES) { |
|
|
|
while (YES) { |
|
|
|
// The following call blocks until an event is available. |
|
|
|
@autoreleasepool { |
|
|
|
grpc_event event = |
|
|
|
// The following call blocks until an event is available. |
|
|
|
grpc_completion_queue_next(unmanagedQueue, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); |
|
|
|
grpc_event event = |
|
|
|
GRPCQueueCompletionHandler handler; |
|
|
|
grpc_completion_queue_next(unmanagedQueue, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); |
|
|
|
switch (event.type) { |
|
|
|
GRPCQueueCompletionHandler handler; |
|
|
|
case GRPC_OP_COMPLETE: |
|
|
|
switch (event.type) { |
|
|
|
handler = (__bridge_transfer GRPCQueueCompletionHandler)event.tag; |
|
|
|
case GRPC_OP_COMPLETE: |
|
|
|
handler(event.success); |
|
|
|
handler = (__bridge_transfer GRPCQueueCompletionHandler)event.tag; |
|
|
|
break; |
|
|
|
handler(event.success); |
|
|
|
case GRPC_QUEUE_SHUTDOWN: |
|
|
|
break; |
|
|
|
grpc_completion_queue_destroy(unmanagedQueue); |
|
|
|
case GRPC_QUEUE_SHUTDOWN: |
|
|
|
return; |
|
|
|
grpc_completion_queue_destroy(unmanagedQueue); |
|
|
|
default: |
|
|
|
return; |
|
|
|
[NSException raise:@"Unrecognized completion type" format:@""]; |
|
|
|
default: |
|
|
|
|
|
|
|
[NSException raise:@"Unrecognized completion type" format:@""]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|