aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/support/sync.c
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2016-03-03 06:59:16 -0800
committerGravatar vjpai <vpai@google.com>2016-03-03 06:59:16 -0800
commitb7117e409bf35895dd9029bd811ac16fd02e3d83 (patch)
tree732339fe04361ad8ebfdb168dedc465c9cfdd5d5 /src/core/support/sync.c
parentc47c9497fa6518205a598c2bf74517df09541fed (diff)
parent40d27ba78455d9c5ef1feef250d0d889d6bfb746 (diff)
Merge branch 'master' into debug_qps_stream
Diffstat (limited to 'src/core/support/sync.c')
-rw-r--r--src/core/support/sync.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/support/sync.c b/src/core/support/sync.c
index d368422d9e..69e3e39c5c 100644
--- a/src/core/support/sync.c
+++ b/src/core/support/sync.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -98,6 +98,11 @@ void gpr_ref_init(gpr_refcount *r, int n) { gpr_atm_rel_store(&r->count, n); }
void gpr_ref(gpr_refcount *r) { gpr_atm_no_barrier_fetch_add(&r->count, 1); }
+void gpr_ref_non_zero(gpr_refcount *r) {
+ gpr_atm prior = gpr_atm_no_barrier_fetch_add(&r->count, 1);
+ GPR_ASSERT(prior > 0);
+}
+
void gpr_refn(gpr_refcount *r, int n) {
gpr_atm_no_barrier_fetch_add(&r->count, n);
}