[Asterisk-code-review] Provide SCOPED LOCK variant for AST RWLIST. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Wed Jun 3 11:33:43 CDT 2015


Richard Mudgett has posted comments on this change.

Change subject: Provide SCOPED_LOCK variant for AST_RWLIST.
......................................................................


Patch Set 1:

{quote}
As I wrote, the current use of AST_RWLIST_UNLOCK as dtor enforces the tight binding of wrapper function definition and cleanup attribute. It is not a function by itself and it doesn't expand to a fixed type expression, but is polymorphic under the value type. This is the only case in the normal source code of Asterisk that behaves like that and IMO by itself poor code.
{quote}

That tight binding you are referring to is true for all RAII_VAR instances as the RAII_VAR dtor function is cusotmized for each and every instance.  Every time ao2_cleanup or ast_free is used for the destructor then a macro expansion happens in the auto generated RAII_VAR dtor function.  The only benefit I see with this patch is the simplification of the places where the linked list lock is scoped.

One way to avoid the exposure of the lock member in the RWLIST outside of the RWLIST macro definitions is to move the SCOPED_RWLIST_RDLOCK/SCOPED_RWLIST_WRLOCK definitions into the linkedlist.h header file instead of the lock.h file.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I201fb77d68ef56f5e0388b256c4c0d624c0277e8
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joerg Sonnenberger <joerg at bec.de>
Gerrit-Reviewer: Joerg Sonnenberger <joerg at bec.de>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: No



More information about the asterisk-code-review mailing list