Adium

Changeset 24296

Show
Ignore:
Timestamp:
07/12/2008 08:07:46 PM (6 months ago)
Author:
catfish_man
Message:

Make ThreadedStressTest obey the THREAD_COUNT define

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/AutoHyperlinks Framework/UnitTests/ThreadedStressTest.m

    r24146 r24296  
    1616-(void) threadedStressTest 
    1717{ 
     18        NSThread* threads[THREAD_COUNT]; 
     19        for(int i = 0; i < THREAD_COUNT; i++) 
     20        { 
     21                threads[i] = [[[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil] autorelease]; 
     22        } 
    1823         
    19         NSThread        *thread1 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    20         NSThread        *thread2 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    21         NSThread        *thread3 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    22         NSThread        *thread4 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    23         NSThread        *thread5 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    24         NSThread        *thread6 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    25         NSThread        *thread7 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    26         NSThread        *thread8 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    27         NSThread        *thread9 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    28         NSThread        *thread0 = [[NSThread alloc] initWithTarget:self selector:@selector(performLinkTest:) object:nil]; 
    29  
    30         [thread1 start]; [thread2 start]; 
    31         [thread3 start]; [thread4 start]; 
    32         [thread5 start]; [thread6 start]; 
    33         [thread7 start]; [thread8 start]; 
    34         [thread9 start]; [thread0 start]; 
     24        for(int i = 0; i < THREAD_COUNT; i++) 
     25        { 
     26                [threads[i] start]; 
     27        } 
    3528         
    36         while(![thread1 isFinished] && ![thread2 isFinished] && 
    37                   ![thread3 isFinished] && ![thread4 isFinished] && 
    38                   ![thread5 isFinished] && ![thread6 isFinished] && 
    39                   ![thread7 isFinished] && ![thread8 isFinished] && 
    40                   ![thread9 isFinished] && ![thread0 isFinished]){ 
     29        while(true) { 
     30                for(int i = 0; i < THREAD_COUNT; i++) 
     31                { 
     32                        if([threads[i] isFinished]) 
     33                                return; 
     34                } 
    4135                [NSThread sleepForTimeInterval:.1]; 
    4236        }