Changeset 3709

Show
Ignore:
Timestamp:
08/10/07 22:58:58 (1 year ago)
Author:
timothy
Message:

Remove some SPI use.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Chat Core/InterThreadMessaging.m

    r3262 r3709  
    5656 
    5757static NSMapTable *pThreadMessagePorts = NULL; 
     58static NSMapTable *pThreadRunLoops = NULL; 
    5859static pthread_mutex_t pGate; 
    5960 
     
    7172    assert(nil != runLoop); 
    7273    assert(NULL != pThreadMessagePorts); 
     74    assert(NULL != pThreadRunLoops); 
    7375 
    7476    pthread_mutex_lock(&pGate); 
     
    8082        [port scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode]; 
    8183        NSMapInsertKnownAbsent(pThreadMessagePorts, thread, port); 
     84        NSMapInsertKnownAbsent(pThreadRunLoops, thread, runLoop); 
    8285 
    8386        /* Transfer ownership of this port to the map table. */ 
     
    111114 
    112115static void 
    113 removeMessagePortForThread (NSThread *thread, NSRunLoop *runLoop
     116removeMessagePortForThread (NSThread *thread
    114117{ 
    115118    NSPort *port; 
     
    122125    port = (NSPort *) NSMapGet(pThreadMessagePorts, thread); 
    123126    if (nil != port) { 
     127        NSRunLoop *runLoop = NSMapGet(pThreadRunLoops, thread); 
    124128        [port removeFromRunLoop:runLoop forMode:NSDefaultRunLoopMode]; 
     129        NSMapRemove(pThreadRunLoops, thread); 
    125130        NSMapRemove(pThreadMessagePorts, thread); 
    126131    } 
     
    147152 
    148153 
    149  
    150 @interface NSThread (SecretStuff) 
    151 - (NSRunLoop *) runLoop; 
    152 @end 
    153154 
    154155@implementation InterThreadManager 
     
    165166            NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, 
    166167                             NSObjectMapValueCallBacks, 0); 
     168        pThreadRunLoops = 
     169            NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, 
     170                             NSObjectMapValueCallBacks, 0); 
    167171 
    168172        [[NSNotificationCenter defaultCenter] 
     
    180184 
    181185    thread = [notification object]; 
    182     runLoop = [thread runLoop]; 
    183     if (nil != runLoop) { 
    184         removeMessagePortForThread(thread, [thread runLoop]); 
    185     } 
     186    removeMessagePortForThread(thread); 
    186187} 
    187188