[Asterisk-code-review] ao2 container: Add support for transparent storage of weakpr... (asterisk[master])

Corey Farrell asteriskteam at digium.com
Thu Sep 15 11:01:31 CDT 2016


Corey Farrell has posted comments on this change.

Change subject: ao2_container: Add support for transparent storage of weakproxy objects.
......................................................................


Patch Set 2:

> > > 4) How to deal with shutdown (cleanup of non-empty container)?
 > >
 > > I don't see a problem.  The container would just unlink any
 > > objects it
 > > contains just like it currently does.  Part of any weak proxy
 > > unlinking
 > > from the container is to unsubscribe from the weak proxy
 > > notifications.
 > 
 > This actually is currently a problem, but I think my idea for #3
 > will solve it.  Currently ao2_weakproxy_subscribe gets a bumped
 > reference to the container, so it is a circular reference.

Passing the node object to ao2_weakproxy_subscribe won't work.  node_obj_proxy_cb requires safe access to the container and it's not safe to use node->my_container unless the container is already locked.

My current ideas:

* Require that weakproxy holder containers be cleared of all objects prior to release.  This option is annoying as it would require two steps to free a weak container or a separate ao2_container_dispose.

* Create or require creation of a weakproxy for the container itself, pass the containers weakproxy to ao2_weakproxy_subscribe so we have a safe way to access the container from node_obj_proxy_cb.  This would solve the circular reference but would not solve the problem of duplicate items.

* Some other refactor of node object lifecycle that I'm not thinking of.  The way cleanup is done for node objects is not like normal ao2.  The end-goal of any refactor would be a safe way to acquire a reference to the container only having a reference to the node.  Not sure this is possible.

-- 
To view, visit https://gerrit.asterisk.org/3749
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I48f2dfb85e97fd0a382a869cd084afda129c95d9
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: No



More information about the asterisk-code-review mailing list