summaryrefslogtreecommitdiff
path: root/Zend/zend_generators.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-10-27 01:28:58 +0300
committerDmitry Stogov <dmitry@zend.com>2017-10-27 01:28:58 +0300
commit49ea143bbd8d0bfcd393d0b5308a5d7833fc087c (patch)
tree071b08e8067e5a6a1e9726e3d76dfe81cc42d6b0 /Zend/zend_generators.c
parent1ab0d820dabc612b7d371d6ed524f60f68101d0f (diff)
downloadphp-git-49ea143bbd8d0bfcd393d0b5308a5d7833fc087c.tar.gz
Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead. Added mactros to validate reference-counting (disabled for now). These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
Diffstat (limited to 'Zend/zend_generators.c')
-rw-r--r--Zend/zend_generators.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index ce7f4374cf..43dfc00e10 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -514,7 +514,7 @@ static void zend_generator_add_child(zend_generator *generator, zend_generator *
if (was_leaf) {
zend_generator *next = generator->node.parent;
leaf->node.ptr.root = generator->node.ptr.root;
- ++GC_REFCOUNT(&generator->std); /* we need to increment the generator refcount here as it became integrated into the tree (no leaf), but we must not increment the refcount of the *whole* path in tree */
+ GC_ADDREF(&generator->std); /* we need to increment the generator refcount here as it became integrated into the tree (no leaf), but we must not increment the refcount of the *whole* path in tree */
generator->node.ptr.leaf = leaf;
while (next) {
@@ -592,7 +592,7 @@ void zend_generator_yield_from(zend_generator *generator, zend_generator *from)
generator->node.parent = from;
zend_generator_get_current(generator);
- --GC_REFCOUNT(&from->std);
+ GC_DELREF(&from->std);
}
ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator, zend_generator *leaf)
@@ -658,7 +658,7 @@ ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator
} else {
do {
root = root->node.parent;
- ++GC_REFCOUNT(&root->std);
+ GC_ADDREF(&root->std);
} while (root->node.parent);
}
}