Changeset 3533

Show
Ignore:
Timestamp:
01/04/07 20:30:58 (2 years ago)
Author:
timothy
Message:

Build fix.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Additions/MVUtilities.h

    r3532 r3533  
    1 #import <Foundation/NSObjCRuntime.h> 
     1#import <pthread.h> 
    22 
    3 NS_INLINE void MVSafeAssign( id *var, id newValue ) { 
     3#define MVInline static __inline__ __attribute__((always_inline)) 
     4 
     5MVInline void MVSafeAssign( id *var, id newValue ) { 
    46        if( *var == newValue ) 
    57                return; 
     
    911} 
    1012 
    11 NS_INLINE void MVSafeRetainAssign( id *var, id newValue ) { 
     13MVInline void MVSafeRetainAssign( id *var, id newValue ) { 
    1214        if( *var == newValue ) 
    1315                return; 
     
    1719} 
    1820 
    19 NS_INLINE void MVSafeCopyAssign( id *var, id newValue ) { 
     21MVInline void MVSafeCopyAssign( id *var, id newValue ) { 
    2022        if( *var == newValue ) 
    2123                return; 
     
    2527} 
    2628 
    27 NS_INLINE id MVSafeReturn( id var ) { 
     29MVInline id MVSafeReturn( id var ) { 
    2830        return [[var retain] autorelease]; 
    2931} 
    3032 
    3133#define MVAssertMainThreadRequired() \ 
    32         NSAssert1( [NSThread isMainThread], @"Method needs to run on the main thread, not %@.", [NSThread currentThread] ) 
     34        NSAssert1( pthread_main_np(), @"Method needs to run on the main thread, not %@.", [NSThread currentThread] ) 
    3335 
    3436#define MVAssertCorrectThreadRequired(thread) \ 
  • trunk/Additions/NSNotificationAdditions.m

    r3532 r3533  
    11#import "NSNotificationAdditions.h" 
     2#import <pthread.h> 
    23 
    34@implementation NSNotificationCenter (NSNotificationCenterAdditions) 
    45- (void) postNotificationOnMainThread:(NSNotification *) notification { 
    5         if( [NSThread isMainThread] ) return [self postNotification:notification]; 
     6        if( pthread_main_np() ) return [self postNotification:notification]; 
    67        [self postNotificationOnMainThread:notification waitUntilDone:NO]; 
    78} 
    89 
    910- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait { 
    10         if( [NSThread isMainThread] ) return [self postNotification:notification]; 
     11        if( pthread_main_np() ) return [self postNotification:notification]; 
    1112        [[self class] performSelectorOnMainThread:@selector( _postNotification: ) withObject:notification waitUntilDone:wait]; 
    1213} 
     
    1718 
    1819- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object { 
    19         if( [NSThread isMainThread] ) return [self postNotificationName:name object:object userInfo:nil]; 
     20        if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:nil]; 
    2021        [self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO]; 
    2122} 
    2223 
    2324- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo { 
    24         if( [NSThread isMainThread] ) return [self postNotificationName:name object:object userInfo:userInfo]; 
     25        if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; 
    2526        [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; 
    2627} 
    2728 
    2829- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait { 
    29         if( [NSThread isMainThread] ) return [self postNotificationName:name object:object userInfo:userInfo]; 
     30        if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; 
    3031 
    3132        NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; 
     
    5051@implementation NSNotificationQueue (NSNotificationQueueAdditions) 
    5152- (void) enqueueNotificationOnMainThread:(NSNotification *) notification postingStyle:(NSPostingStyle) postingStyle { 
    52         if( [NSThread isMainThread] ) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:( NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender ) forModes:nil]; 
     53        if( pthread_main_np() ) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:( NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender ) forModes:nil]; 
    5354        [self enqueueNotificationOnMainThread:notification postingStyle:postingStyle coalesceMask:( NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender ) forModes:nil]; 
    5455} 
    5556 
    5657- (void) enqueueNotificationOnMainThread:(NSNotification *) notification postingStyle:(NSPostingStyle) postingStyle coalesceMask:(unsigned) coalesceMask forModes:(NSArray *) modes { 
    57         if( [NSThread isMainThread] ) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:coalesceMask forModes:modes]; 
     58        if( pthread_main_np() ) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:coalesceMask forModes:modes]; 
    5859 
    5960        NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:4]; 
  • trunk/Chat Core/MVIRCChatConnection.m

    r3532 r3533  
    222222 
    223223- (void) disconnectWithReason:(NSAttributedString *) reason { 
    224         [self performSelector:@selector( cancelPendingReconnectAttempts ) withObject:nil inThread:[NSThread mainThread]]; 
     224        [self performSelectorOnMainThread:@selector( cancelPendingReconnectAttempts ) withObject:nil waitUntilDone:NO]; 
    225225 
    226226        if( _sendQueueProcessing && _connectionThread )