Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -122,10 +122,11 @@ of_point_t origin; of_dimension_t size; } of_rectangle_t; @class OFString; +@class OFThread; /** * \brief The protocol which all root classes implement. */ @protocol OFObject @@ -631,10 +632,55 @@ * the selector * \param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector withObject: (id)object1 + withObject: (id)object2 + afterDelay: (double)delay; + +/** + * \brief Performs the specified selector on the specified thread after the + * specified delay. + * + * \param selector The selector to perform + * \param thread The thread on which to perform the selector + * \param delay The delay after which the selector will be performed + */ +- (void)performSelector: (SEL)selector + onThread: (OFThread*)thread + afterDelay: (double)delay; + +/** + * \brief Performs the specified selector on the specified thread with the + * specified object after the specified delay. + * + * \param selector The selector to perform + * \param thread The thread on which to perform the selector + * \param object The object that is passed to the method specified by the + * selector + * \param delay The delay after which the selector will be performed + */ +- (void)performSelector: (SEL)selector + onThread: (OFThread*)thread + withObject: (id)object + afterDelay: (double)delay; + +/** + * \brief Performs the specified selector on the specified thread with the + * specified objects after the specified delay. + * + * \param selector The selector to perform + * \param thread The thread on which to perform the selector + * \param object1 The first object that is passed to the method specified by the + * selector + * \param object2 The second object that is passed to the method specified by + * the selector + * \param delay The delay after which the selector will be performed + */ +- (void)performSelector: (SEL)selector + onThread: (OFThread*)thread + withObject: (id)object1 withObject: (id)object2 afterDelay: (double)delay; @end /** Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -30,10 +30,12 @@ # include #endif #import "OFObject.h" #import "OFTimer.h" +#import "OFThread.h" +#import "OFRunLoop.h" #import "OFAllocFailedException.h" #import "OFEnumerationMutationException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" @@ -617,10 +619,58 @@ target: self selector: selector object: object object: object repeats: NO]; + + objc_autoreleasePoolPop(pool); +} + +- (void)performSelector: (SEL)selector + onThread: (OFThread*)thread + afterDelay: (double)delay +{ + void *pool = objc_autoreleasePoolPush(); + + [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay + target: self + selector: selector + repeats: NO]]; + + objc_autoreleasePoolPop(pool); +} + +- (void)performSelector: (SEL)selector + onThread: (OFThread*)thread + withObject: (id)object + afterDelay: (double)delay +{ + void *pool = objc_autoreleasePoolPush(); + + [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay + target: self + selector: selector + object: object + repeats: NO]]; + + objc_autoreleasePoolPop(pool); +} + +- (void)performSelector: (SEL)selector + onThread: (OFThread*)thread + withObject: (id)object + withObject: (id)otherObject + afterDelay: (double)delay +{ + void *pool = objc_autoreleasePoolPush(); + + [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay + target: self + selector: selector + object: object + object: object + repeats: NO]]; objc_autoreleasePoolPop(pool); } - (const char*)typeEncodingForSelector: (SEL)selector