[svn-commits] qwell: trunk r393919 - /trunk/include/asterisk/lock.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 9 16:40:45 CDT 2013


Author: qwell
Date: Tue Jul  9 16:40:38 2013
New Revision: 393919

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393919
Log:
Make SCOPED_LOCK use RAII_VAR.

This fixes an issue with requiring SCOPED_LOCK to be the last variable
declaration and removes duplicate code in the process.

Review: https://reviewboard.asterisk.org/r/2665/

Modified:
    trunk/include/asterisk/lock.h

Modified: trunk/include/asterisk/lock.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=393919&r1=393918&r2=393919
==============================================================================
--- trunk/include/asterisk/lock.h (original)
+++ trunk/include/asterisk/lock.h Tue Jul  9 16:40:38 2013
@@ -600,9 +600,7 @@
  * \param unlockfunc The function to call to unlock the lock
  */
 #define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc) \
-	auto void _dtor_ ## varname (typeof((lock)) * v); \
-	auto void _dtor_ ## varname (typeof((lock)) * v) { unlockfunc(*v); } \
-	typeof((lock)) varname __attribute__((cleanup(_dtor_ ## varname))) = lock; lockfunc((lock))
+	RAII_VAR(typeof((lock)), varname, ({lockfunc((lock)); (lock); }), unlockfunc)
 
 /*!
  * \brief scoped lock specialization for mutexes




More information about the svn-commits mailing list