diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-02-04 23:41:51 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-02-04 23:41:51 +0100 |
commit | 900dadb2df70c41f5008db854f9ff1cec5920f03 (patch) | |
tree | 101ea8d827dc4d012bfcbb0042c953199ef9c8a0 /src/core/iomgr | |
parent | ee0c96c7fc4bdcf908969eedb96b248e33db1cbb (diff) | |
parent | 034152f5befdc06dbd9b4bf613b8ab152c2625df (diff) |
Merge branch 'master' of github.com:google/grpc into grpc-win32
Conflicts:
include/grpc/support/time_win32.h
Diffstat (limited to 'src/core/iomgr')
-rw-r--r-- | src/core/iomgr/iomgr.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/iomgr/iomgr.c b/src/core/iomgr/iomgr.c index 8989b491d5..3d6114ca18 100644 --- a/src/core/iomgr/iomgr.c +++ b/src/core/iomgr/iomgr.c @@ -51,6 +51,7 @@ typedef struct delayed_callback { static gpr_mu g_mu; static gpr_cv g_cv; +static gpr_cv g_rcv; static delayed_callback *g_cbs_head = NULL; static delayed_callback *g_cbs_tail = NULL; static int g_shutdown; @@ -86,6 +87,7 @@ void grpc_iomgr_init(void) { gpr_thd_id id; gpr_mu_init(&g_mu); gpr_cv_init(&g_cv); + gpr_cv_init(&g_rcv); grpc_alarm_list_init(gpr_now()); g_refs = 0; grpc_iomgr_platform_init(); @@ -115,7 +117,7 @@ void grpc_iomgr_shutdown(void) { gpr_mu_lock(&g_mu); } if (g_refs) { - if (gpr_cv_wait(&g_cv, &g_mu, shutdown_deadline) && g_cbs_head == NULL) { + if (gpr_cv_wait(&g_rcv, &g_mu, shutdown_deadline) && g_cbs_head == NULL) { gpr_log(GPR_DEBUG, "Failed to free %d iomgr objects before shutdown deadline: " "memory leaks are likely", @@ -126,12 +128,14 @@ void grpc_iomgr_shutdown(void) { } gpr_mu_unlock(&g_mu); + grpc_kick_poller(); gpr_event_wait(&g_background_callback_executor_done, gpr_inf_future); grpc_iomgr_platform_shutdown(); grpc_alarm_list_shutdown(); gpr_mu_destroy(&g_mu); gpr_cv_destroy(&g_cv); + gpr_cv_destroy(&g_rcv); } void grpc_iomgr_ref(void) { @@ -143,7 +147,7 @@ void grpc_iomgr_ref(void) { void grpc_iomgr_unref(void) { gpr_mu_lock(&g_mu); if (0 == --g_refs) { - gpr_cv_signal(&g_cv); + gpr_cv_signal(&g_rcv); } gpr_mu_unlock(&g_mu); } |