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

Richard Mudgett asteriskteam at digium.com
Wed Jun 3 17:04:32 CDT 2015


Richard Mudgett has posted comments on this change.

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


Patch Set 1:

{quote}
The difference with the expansion of ao2_cleanup and co is that it is invariant under the arguments. You always start more or less from a void * and get a void *. With AST_RWLIST_UNLOCK, you start from some list type and end up with a ast_rwlock_t. The list type is the argument to the dtor, not ast_rwlock_t.
{quote}

As far as the dtor is concerned AST_RWLIST_UNLOCK is an inlined function that takes a variable of the list type.  The parameter passed to AST_RWLIST_UNLOCK is not a type it is the RAII_VAR varname variable that is declared by RAII_VAR.

I still do not see how this is a problem.  Is the compiler generating a diagnostic message?  Otherwise, this patch just makes declaring RWLIST scoped locks simpler; which is fine.

There is no need to create an accessor macro for the lock member to only use it with the new macro when the macro can simply be declared in linkedlist.h.  You have to include linkedlist.h anyway to even use a RWLIST and there is no need to declare the scoped list lock if linkedlist.h is not included.

-- 
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