[RFC] mutex locking/destroying
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Wapme Systems AG |
| Message-ID | <[email protected]> |
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