Ignore:
Timestamp:
Dec 3, 2007, 4:06:45 AM (14 years ago)
Author:
charles
Message:

fix very annoying recursive mutex + pthread cond bug reported by setatg, Waldorf, and many others

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r3918 r4043  
    110110    int                  normalMax;
    111111    tr_lock            * lock;
    112     tr_cond            * cond;
    113112    struct tr_openfile   open[TR_MAX_OPEN_FILES];
    114113};
     
    181180    o->fd = -1;
    182181    o->isCheckedOut = 0;
    183     tr_condSignal( gFd->cond );
    184182}
    185183
     
    216214        if( fileIsCheckedOut( o ) ) {
    217215            dbgmsg( "found it!  it's open, but checked out.  waiting..." );
    218             tr_condWait( gFd->cond, gFd->lock );
     216            tr_wait( 100 );
    219217            i = -1; /* reloop */
    220218            continue;
     
    263261        /* All used! Wait a bit and try again */
    264262        dbgmsg( "everything's full!  waiting for someone else to finish something" );
    265         tr_condWait( gFd->cond, gFd->lock );
     263        tr_wait( 100 );
    266264    }
    267265
     
    310308    }
    311309   
    312     tr_condSignal( gFd->cond );
    313310    tr_lockUnlock( gFd->lock );
    314311}
     
    336333    }
    337334   
    338     tr_condSignal( gFd->cond );
    339335    tr_lockUnlock( gFd->lock );
    340336}
     
    463459    gFd = tr_new0( struct tr_fd_s, 1 );
    464460    gFd->lock = tr_lockNew( );
    465     gFd->cond = tr_condNew( );
    466461
    467462    /* count the max number of sockets we can use */
     
    491486
    492487    tr_lockFree( gFd->lock );
    493     tr_condFree( gFd->cond );
    494488
    495489    tr_list_free( &reservedSockets, NULL );
Note: See TracChangeset for help on using the changeset viewer.