[asterisk-dev] Proper use of locking.

Michael Cargile mcargile at explido.us
Thu Jul 19 17:06:05 CDT 2007


On Fri, 2007-07-20 at 09:05 +1200, Derek Smithies wrote:
> And of the need to copy data (which is reported for logging (say)) and 
> then freeing the mutex in the minimum of time - is there any plan of work 
> in this direction ?

   In regards to this I pulled in the latest SVN and looked into three
of the many files that I know to do this. app_meetme app_queue and
chan_agent. Just looking for ast_log calls while locked (not
ast_verbose, ast_debug, or anything dealing with the manager events, or
the cli) I found the following lines:

app_meetme.c:
795, 798, 809, 2822, 2975, 4849, 4858

app_queue.c:
3155, 3175, 3180, 3185, 3190, 3199, 3825

chan_agent.c:
442, 568, 621, 653, 663, 737, 749, 941, 954, 1287, 1320, 1866, 1871,
1952

   Now with regards to app_meetme I think that this is probably cut in
half from the 1.2 version but the problem remains. But based off the
amount of changes that have been made to app_meetme from 1.2 to SVN I am
shocked that there are any in there.

   All I am asking for is a janitorial project to clean this stuff up
and an addition to the coding guidelines spelling out what is acceptable
to do while in a lock, along with some locking concepts. Possibly
creating some functions that store logging, manager events, cli output,
etc in a FIFO queue tied to that thread till a lock is released would be
a good idea as well. Adding the section to the coding guidelines should
hopefully cut down on the number of patches that have to be rejected.

Michael Cargile
Explido Software USA Inc.
www.explido.us




More information about the asterisk-dev mailing list