@@ -17,10 +17,11 @@ #import "OFObject.h" @class OFTimer; @class OFDate; @class OFCondition; +@class OFRunLoop; #ifdef OF_HAVE_BLOCKS typedef void (^of_timer_block_t)(OFTimer*); #endif @@ -38,14 +39,15 @@ #ifdef OF_HAVE_BLOCKS of_timer_block_t block; #endif BOOL isValid, done; OFCondition *condition; + OFRunLoop *inRunLoop; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, retain) OFDate *fireDate; +@property (retain) OFDate *fireDate; #endif /*! * @brief Creates and schedules a new timer with the specified time interval. * @@ -273,10 +275,22 @@ * * @return The next date at which the timer will fire */ - (OFDate*)fireDate; +/*! + * @brief Sets the next date at which the timer will fire. + * + * If the timer is already scheduled in a run loop, it will be rescheduled. + * Note that rescheduling is an expensive operation, though it still might be + * preferrable to reschedule instead of invalidating the timer and creating a + * new one. + * + * @param fireDate The next date at which the timer will fire + */ +- (void)setFireDate: (OFDate*)fireDate; + /*! * @brief Invalidates the timer, preventing it from firing. */ - (void)invalidate; @@ -298,6 +312,8 @@ /*! * @brief Waits until the timer fired. */ - (void)waitUntilDone; + +- (void)OF_setInRunLoop: (OFRunLoop*)inRunLoop; @end