[nginx] How to check node has been deleted from rbtree?

洪志道 hongzhidao at gmail.com
Mon Jul 9 11:51:47 UTC 2018


Hi.

As shown the subject, I wonder how to check some node has been deleted from
the red-black tree?

The case is like the following:

Step 1:
node1 = ngx_rbtree_insert(...);
node2 = ngx_rbtree_insert(...);
node3 = ngx_rbtree_insert(...);

Step 2:
node = find_node_from_rbtree(...);
remove_expired_node(...); /* maybe include the node just found. */
new_node = malloc(...);
if (new_node == NULL) {
      return;
}
/* We should keep the found node alive until the new node is succefully
allocated */
if (is_in_rbtree(node)) {  /* I wonder how to check */
    ngx_rbtree_delete(...);
}
ngx_rbtree_insert(new_node);

Or have other suggestions?

Thanks.
B.R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180709/677667c0/attachment-0001.html>


More information about the nginx-devel mailing list