Changeset 5333


Ignore:
Timestamp:
May 29, 2011, 7:30:20 PM (8 years ago)
Author:
Admin
Message:

Only wait up to 500ms in llist destroy as there seem to exist deadlock conditions...

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals.h

    r5328 r5333  
    16851685// oscam-garbage
    16861686#ifdef WITH_DEBUG
    1687 extern void add_garbage_debug(void *data, char *file, int32_t line);
     1687extern void add_garbage_debug(void *data, char *file, uint16_t line);
    16881688#define add_garbage(x)  add_garbage_debug(x,__FILE__, __LINE__)
    16891689#else
  • trunk/module-datastruct-llist.c

    r5307 r5333  
    1919{
    2020    if (!l) return;
    21     int32_t oldtype;
     21    int32_t oldtype, res, i = 0;
    2222    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldtype);       
    23     if (!l->flag++) {       
    24         pthread_mutex_lock(&l->lock);
    25         pthread_mutex_unlock(&l->lock);
    26         pthread_mutex_destroy(&l->lock);
     23    if (!l->flag++) {
     24        /* FIXME: Because of unknown reasons we sometimes get a deadlock here if we use pthread_mutex_lock. So only wait up to about 500ms... */   
     25        while(i < 25 && (res = pthread_mutex_trylock(&l->lock)) == EBUSY){         
     26            cs_sleepms(20);
     27            ++i;
     28        }
     29        if(res == 0)
     30            pthread_mutex_unlock(&l->lock);
     31        if(res != EINVAL && res != EFAULT)
     32            pthread_mutex_destroy(&l->lock);
    2733        add_garbage(l);
    2834    }
  • trunk/oscam-garbage.c

    r5305 r5333  
    1010        #ifdef WITH_DEBUG
    1111        char *file;
    12         int32_t line;
     12        uint16_t line;
    1313        #endif
    1414        struct cs_garbage *next;
     
    2222
    2323#ifdef WITH_DEBUG
    24 void add_garbage_debug(void *data, char *file, int32_t line) {
     24void add_garbage_debug(void *data, char *file, uint16_t line) {
    2525#else
    2626void add_garbage(void *data) {
Note: See TracChangeset for help on using the changeset viewer.