1/* 2 NSObject_PPUtilities.m 3 4 Copyright 2013-2018 Josh Freeman 5 http://www.twilightedge.com 6 7 This file is part of PikoPixel for Mac OS X and GNUstep. 8 PikoPixel is a graphical application for drawing & editing pixel-art images. 9 10 PikoPixel is free software: you can redistribute it and/or modify it under 11 the terms of the GNU Affero General Public License as published by the 12 Free Software Foundation, either version 3 of the License, or (at your 13 option) any later version approved for PikoPixel by its copyright holder (or 14 an authorized proxy). 15 16 PikoPixel is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more 19 details. 20 21 You should have received a copy of the GNU Affero General Public License 22 along with this program. If not, see <http://www.gnu.org/licenses/>. 23*/ 24 25#import "NSObject_PPUtilities.h" 26 27 28@implementation NSObject (PPUtilities) 29 30- (void) ppPerformSelectorFromNewStackFrame: (SEL) aSelector 31{ 32 [self performSelector: aSelector withObject: nil afterDelay: 0.0f]; 33} 34 35- (void) ppPerformSelectorAtomicallyFromNewStackFrame: (SEL) aSelector 36{ 37 [[self class] cancelPreviousPerformRequestsWithTarget: self 38 selector: aSelector 39 object: nil]; 40 41 [self ppPerformSelectorFromNewStackFrame: aSelector]; 42} 43 44- (void) ppPerformSelectorAtomically: (SEL) aSelector afterDelay: (NSTimeInterval) delay 45{ 46 [[self class] cancelPreviousPerformRequestsWithTarget: self 47 selector: aSelector 48 object: nil]; 49 50 [self performSelector: aSelector withObject: nil afterDelay: delay]; 51} 52 53@end 54