Changeset 12608


Ignore:
Timestamp:
Aug 1, 2011, 10:27:21 PM (10 years ago)
Author:
livings124
Message:

more experimenting with locking in the files table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileOutlineController.m

    r12599 r12608  
    3232#import <Quartz/Quartz.h>
    3333
     34#import "utils.h"
     35
    3436#define ROW_SMALL_HEIGHT 18.0
    3537
     
    7072    [fOutline setMenu: [self menu]];
    7173   
    72     #warning needed?
    7374    fLock = [[NSRecursiveLock alloc] init];
     75    [fLock setName: @"File Table"];
    7476   
    7577    [self setTorrent: nil];
     
    100102    fFilterText = nil;
    101103   
    102     [fLock lock];
     104    while (![fLock tryLock])
     105        tr_wait_msec(100);
    103106   
    104107    [fOutline deselectAll: nil];
     
    120123    const BOOL onLion = [NSApp isOnLionOrBetter];
    121124   
    122     [fLock lock];
     125    while (![fLock tryLock])
     126        tr_wait_msec(100);
    123127   
    124128    if (onLion)
    125129    {
    126         [[NSAnimationContext currentContext] setCompletionHandler: ^{ [fLock unlock]; NSLog(@"called"); }];
     130        [[NSAnimationContext currentContext] setCompletionHandler: ^{ [fLock unlock]; }];
    127131        [NSAnimationContext beginGrouping];
    128132       
     
    225229    [fTorrent updateFileStat];
    226230   
    227     [fLock lock];
     231    while (![fLock tryLock])
     232        tr_wait_msec(100);
    228233   
    229234    [fOutline reloadData];
     
    368373- (void) setCheck: (id) sender
    369374{
    370     [fLock lock];
     375    while (![fLock tryLock])
     376        tr_wait_msec(100);
    371377   
    372378    NSInteger state = [sender tag] == FILE_UNCHECK_TAG ? NSOffState : NSOnState;
     
    385391- (void) setOnlySelectedCheck: (id) sender
    386392{
    387     [fLock lock];
     393    while (![fLock tryLock])
     394        tr_wait_msec(100);
    388395   
    389396    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
     
    418425    }
    419426   
    420     [fLock lock];
     427    while (![fLock tryLock])
     428        tr_wait_msec(100);
    421429   
    422430    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
     
    433441- (void) revealFile: (id) sender
    434442{
    435     [fLock lock];
     443    while (![fLock tryLock])
     444        tr_wait_msec(100);
    436445   
    437446    NSIndexSet * indexes = [fOutline selectedRowIndexes];
Note: See TracChangeset for help on using the changeset viewer.