|
|
@ -158,7 +158,7 @@ void grpc_iomgr_shutdown(void) { |
|
|
|
"memory leaks are likely", |
|
|
|
"memory leaks are likely", |
|
|
|
count_objects()); |
|
|
|
count_objects()); |
|
|
|
for (obj = g_root_object.next; obj != &g_root_object; obj = obj->next) { |
|
|
|
for (obj = g_root_object.next; obj != &g_root_object; obj = obj->next) { |
|
|
|
gpr_log(GPR_DEBUG, "LEAKED OBJECT: %s", obj->name); |
|
|
|
gpr_log(GPR_DEBUG, "LEAKED OBJECT: %s %p", obj->name, obj); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -177,8 +177,9 @@ void grpc_iomgr_shutdown(void) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void grpc_iomgr_register_object(grpc_iomgr_object *obj, const char *name) { |
|
|
|
void grpc_iomgr_register_object(grpc_iomgr_object *obj, const char *name) { |
|
|
|
gpr_mu_lock(&g_mu); |
|
|
|
|
|
|
|
obj->name = gpr_strdup(name); |
|
|
|
obj->name = gpr_strdup(name); |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "register: %s %p", obj->name, obj); |
|
|
|
|
|
|
|
gpr_mu_lock(&g_mu); |
|
|
|
obj->next = &g_root_object; |
|
|
|
obj->next = &g_root_object; |
|
|
|
obj->prev = obj->next->prev; |
|
|
|
obj->prev = obj->next->prev; |
|
|
|
obj->next->prev = obj->prev->next = obj; |
|
|
|
obj->next->prev = obj->prev->next = obj; |
|
|
@ -186,12 +187,13 @@ void grpc_iomgr_register_object(grpc_iomgr_object *obj, const char *name) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void grpc_iomgr_unregister_object(grpc_iomgr_object *obj) { |
|
|
|
void grpc_iomgr_unregister_object(grpc_iomgr_object *obj) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "unregister: %s %p", obj->name, obj); |
|
|
|
gpr_mu_lock(&g_mu); |
|
|
|
gpr_mu_lock(&g_mu); |
|
|
|
obj->next->prev = obj->prev; |
|
|
|
obj->next->prev = obj->prev; |
|
|
|
obj->prev->next = obj->next; |
|
|
|
obj->prev->next = obj->next; |
|
|
|
gpr_free(obj->name); |
|
|
|
|
|
|
|
gpr_cv_signal(&g_rcv); |
|
|
|
gpr_cv_signal(&g_rcv); |
|
|
|
gpr_mu_unlock(&g_mu); |
|
|
|
gpr_mu_unlock(&g_mu); |
|
|
|
|
|
|
|
gpr_free(obj->name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void grpc_iomgr_closure_init(grpc_iomgr_closure *closure, grpc_iomgr_cb_func cb, |
|
|
|
void grpc_iomgr_closure_init(grpc_iomgr_closure *closure, grpc_iomgr_cb_func cb, |
|
|
|