[asterisk-dev] problem with mutex

Garavaglia Fabio garavaglia.fab at tiscali.it
Thu Dec 14 09:17:05 MST 2006


Russell Bryant ha scritto:
> Garavaglia Fabio wrote:
>> i'm trying to modify the fs of asterisk but i have big problems about 
>
> What is "the fs of asterisk" ?
>
for the file system of asterisk I intend how asterisk memorize context, 
extension etc.
i'm trying to change the list (of contexts) of list (of extensions)with 
an hash table for the context and an rb tree for the extension contained 
in every context.

>> thread and mutex. In fact the execution is stopped at the start of 
>> the session although the compilation is OK.
>> this is the result of the execution into gdb
>> ...
>>  > [res_features.so] => (Call Features Resource)
>>  >  == Parsing '/etc/asterisk/features.conf': Found
>>  > I type ctrl C
>>  > Program received signal SIGINT, Interrupt.
>>  > [Switching to Thread -1208464464 (LWP 30428)]
>>  > 0x00b71402 in __kernel_vsyscall ()
>>  > (gdb) bt
>>  > #0  0x00b71402 in __kernel_vsyscall ()
>>  > #1  0x0088f580 in poll () from /lib/libc.so.6
>>  > #2  0x080b5aee in listener (unused=0x0) at asterisk.c:585
>>  > #3  0x00a27bd4 in start_thread () from /lib/libpthread.so.0
>>  > #4  0x008994fe in clone () from /lib/libc.so.6
>>  > (gdb)
>> i think it's a problem with mutex,what do you think about?have you 
>> got some ideas?
>
> There is nothing in this backtrace that suggests the problem you are 
> seeing has anything to do with a mutex.  This thread is blocking on a 
> call to poll(), which was probably passed a negative timeout value, 
> which sets the timeout to infinite.
yes, in fact:
static void *listener(void *unused)
{
        struct sockaddr_un sunaddr;
        int s;
        socklen_t len;
        int x;
        int flags;
        struct pollfd fds[1];
        pthread_attr_t attr;
        pthread_attr_init(&attr);
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
        for(;;) {
                if (ast_socket < 0)
                        return NULL;
                fds[0].fd = ast_socket;
                fds[0].events= POLLIN;
                s = poll(fds, 1, -1);
so i think that the lockout is caused by a mutex problem.
i didn't modified this function,so what can i do?what is the problem?

>
>> ps I use asterisk 1.2.4
>
> I'm not sure what you're doing this work for, but even if it's for 
> something in 1.2, you should definitely be using the latest release.  
> 1.2.4 is quite old.
>
i use asterisk1.2.4 for my graduation thesis,and now is too late for 
changing the release...


More information about the asterisk-dev mailing list