Fix lock errors on startup.
authorDavid M. Lee <dlee@digium.com>
Thu, 18 Apr 2013 17:26:29 +0000 (17:26 +0000)
committerDavid M. Lee <dlee@digium.com>
Thu, 18 Apr 2013 17:26:29 +0000 (17:26 +0000)
commitaff127a73722d37e2cd78b61046f1f5dce012426
treea7fcbb52324cd10f49a0d7c933d5da305803cf64
parentfed7249ad1a20f5c6ecf8e657a2e83f4af8b379b
Fix lock errors on startup.

In messages.c, there are several places in the code where we create a
tmp_tech_holder and pass that into an ao2_find call. Unfortunately, we
weren't initializing the rwlock on the tmp_tech_holder, which the hash
function was locking. It's apparently harmless, but still not the best
code.

This patch extracts all that copy/pasted code into two functions,
msg_find_by_tech and msg_find_by_tech_name, which properly initialize
and destroy the rwlock on the tmp_tech_holder.

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

Merged revisions 386006 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
main/message.c