Skip to content

Commit

Permalink
solve freeze problem uses VS Debugger with UNITY.
Browse files Browse the repository at this point in the history
  • Loading branch information
h-shn-k committed Feb 13, 2017
1 parent 7de1f24 commit eb4b4fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion include/grpc/grpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved);
Callers must not call grpc_completion_queue_next and
grpc_completion_queue_pluck simultaneously on the same completion queue. */
typedef void(*magic_for_debug_callback_funcptr)();
GRPCAPI grpc_event grpc_completion_queue_next(grpc_completion_queue *cq,
gpr_timespec deadline,
void *reserved);
void *reserved,
magic_for_debug_callback_funcptr callback);

/** Blocks until an event with tag 'tag' is available, the completion queue is
being shutdown or deadline is reached.
Expand Down
7 changes: 6 additions & 1 deletion src/core/lib/surface/completion_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ static void dump_pending_tags(grpc_completion_queue *cc) {}
#endif

grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
gpr_timespec deadline, void *reserved) {
gpr_timespec deadline, void *reserved,
magic_for_debug_callback_funcptr callback) {
grpc_event ret;
grpc_pollset_worker *worker = NULL;
gpr_timespec now;
Expand Down Expand Up @@ -405,6 +406,10 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT_WITH_FINISH_CHECK(
cq_is_next_finished, &is_finished_arg);
for (;;) {
if (callback != NULL) {
callback();
}

if (is_finished_arg.stolen_completion != NULL) {
gpr_mu_unlock(cc->mu);
grpc_cq_completion *c = is_finished_arg.stolen_completion;
Expand Down
10 changes: 8 additions & 2 deletions src/csharp/ext/grpc_csharp_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,14 @@ grpcsharp_completion_queue_destroy(grpc_completion_queue *cq) {

GPR_EXPORT grpc_event GPR_CALLTYPE
grpcsharp_completion_queue_next(grpc_completion_queue *cq) {
return grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
NULL);
return grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
NULL, NULL);
}

GPR_EXPORT grpc_event GPR_CALLTYPE
grpcsharp_completion_queue_next_debuggable(grpc_completion_queue *cq, magic_for_debug_callback_funcptr callback) {
return grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
NULL, callback);
}

GPR_EXPORT grpc_event GPR_CALLTYPE
Expand Down

0 comments on commit eb4b4fd

Please sign in to comment.