Exemplo n.º 1
0
static void ru_shutdown(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
  grpc_resource_user *resource_user = ru;
  grpc_closure_sched(exec_ctx, resource_user->reclaimers[0],
                     GRPC_ERROR_CANCELLED);
  grpc_closure_sched(exec_ctx, resource_user->reclaimers[1],
                     GRPC_ERROR_CANCELLED);
  resource_user->reclaimers[0] = NULL;
  resource_user->reclaimers[1] = NULL;
  rulist_remove(resource_user, GRPC_RULIST_RECLAIMER_BENIGN);
  rulist_remove(resource_user, GRPC_RULIST_RECLAIMER_DESTRUCTIVE);
}
Exemplo n.º 2
0
static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
  grpc_resource_user *resource_user = ru;
  GPR_ASSERT(resource_user->allocated == 0);
  for (int i = 0; i < GRPC_RULIST_COUNT; i++) {
    rulist_remove(resource_user, (grpc_rulist)i);
  }
  grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[0],
                      GRPC_ERROR_CANCELLED, NULL);
  grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[1],
                      GRPC_ERROR_CANCELLED, NULL);
  grpc_exec_ctx_sched(exec_ctx, (grpc_closure *)gpr_atm_no_barrier_load(
                                    &resource_user->on_done_destroy_closure),
                      GRPC_ERROR_NONE, NULL);
  if (resource_user->free_pool != 0) {
    resource_user->resource_quota->free_pool += resource_user->free_pool;
    rq_step_sched(exec_ctx, resource_user->resource_quota);
  }
}
Exemplo n.º 3
0
static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
  grpc_resource_user *resource_user = ru;
  GPR_ASSERT(gpr_atm_no_barrier_load(&resource_user->refs) == 0);
  for (int i = 0; i < GRPC_RULIST_COUNT; i++) {
    rulist_remove(resource_user, (grpc_rulist)i);
  }
  grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[0],
                      GRPC_ERROR_CANCELLED, NULL);
  grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[1],
                      GRPC_ERROR_CANCELLED, NULL);
  if (resource_user->free_pool != 0) {
    resource_user->resource_quota->free_pool += resource_user->free_pool;
    rq_step_sched(exec_ctx, resource_user->resource_quota);
  }
  grpc_resource_quota_internal_unref(exec_ctx, resource_user->resource_quota);
  gpr_mu_destroy(&resource_user->mu);
  gpr_free(resource_user->name);
  gpr_free(resource_user);
}