Re: [RFC] mutex locking/destroying

Nisan Bloch <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi

yup.. +1 from me

  in fact looking at our code i see i have patched this and forgotten to post..

nisan
At 03:24 PM 8/9/02 +0200, Stipe Tolj wrote:
>I have done some debug testing with the 'valgrind' that Kalle
>suggested and came accross some points:
>
>==29137==
>==29137== 411 errors in context 2 of 2:
>==29137== pthread_mutex_destroy: mutex is still in use
>==29137==    at 0x4029FB7F: pthread_error (vg_libpthread.c:231)
>==29137==    by 0x402A0A18: __pthread_mutex_destroy
>(vg_libpthread.c:848)
>==29137==    by 0x808C8ED: mutex_destroy (gwlib/thread.c:55)
>==29137==    by 0x808676E: list_destroy (gwlib/list.c:97)
>
>which refers to the code in gwlib/list.c:
>
>void list_destroy(List *list, list_item_destructor_t *destructor)
>{
>     void *item;
>
>     if (list == NULL)
>         return;
>
>     if (destructor != NULL) {
>         while ((item = list_extract_first(list)) != NULL)
>             destructor(item);
>     }
>
>     mutex_lock(list->permanent_lock);           <------
>     mutex_destroy(list->permanent_lock);
>     mutex_destroy(list->single_operation_lock);
>     pthread_cond_destroy(&list->nonempty);
>     gw_free(list->tab);
>     gw_free(list);
>}
>
>I guess we should not lock a mutex that is then destroyed, right?!
>
>Stipe
>
>[email protected]
>-------------------------------------------------------------------
>Wapme Systems AG
>
>Vogelsanger Weg 80
>40470 Düsseldorf
>
>Tel: +49-211-74845-0
>Fax: +49-211-74845-299
>
>E-Mail: [email protected]
>Internet: http://www.wapme-systems.de
>-------------------------------------------------------------------
>wapme.net - wherever you are
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.