Hi, all:<br><br>&nbsp;&nbsp;&nbsp;&nbsp; Asterisk1.2.10,&nbsp; in pbx.c, the ast_custom_function_register is<br><br>int ast_custom_function_register(struct ast_custom_function *acf) <br>{<br>&nbsp;&nbsp;&nbsp; if (!acf)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br><br>&nbsp;&nbsp;&nbsp; /* try to lock functions list ... */
<br>&nbsp;&nbsp;&nbsp; if (ast_mutex_lock(&amp;acflock)) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ast_log(LOG_ERROR, &quot;Unable to lock function list. Failed registering function %s\n&quot;, acf-&gt;name);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; if (ast_custom_function_find(acf-&gt;name)) {
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ast_log(LOG_ERROR, &quot;Function %s already registered.\n&quot;, acf-&gt;name);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ast_mutex_unlock(&amp;acflock);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; /* ......... */<br>}<br><br>struct ast_custom_function* ast_custom_function_find(char *name) 
<br>{<br>&nbsp;&nbsp;&nbsp; struct ast_custom_function *acfptr;<br><br>&nbsp;&nbsp;&nbsp; /* try to lock functions list ... */<br>&nbsp;&nbsp;&nbsp; if (ast_mutex_lock(&amp;acflock)) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ast_log(LOG_ERROR, &quot;Unable to lock function list\n&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return NULL;
<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp; /* ....... */<br>}<br><br>The mutex acflock is locked twice,&nbsp; so, the process will be deadlock here, but it's not in fact.<br>Why? Is there something that I missed?<br><br>