ObjFW  Check-in [e9cbd5e12a]

Overview
Comment:Add -[performSelector:onThread:waitUntilDone:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e9cbd5e12a2ec24d38071ac934dfc6a408ced81b1f3dcf85e517de74d5628f10
User & Date: js on 2012-09-16 22:31:17
Other Links: manifest | tags
Context
2012-09-17
06:38
OFThread: Run the run loop if there is no main. check-in: ade50547f6 user: js tags: trunk
2012-09-16
22:31
Add -[performSelector:onThread:waitUntilDone:]. check-in: e9cbd5e12a user: js tags: trunk
22:29
Add -[OFTimer waitUntilDone]. check-in: c96dbe88c6 user: js tags: trunk
Changes

Modified src/OFObject.h from [38e57fe783] to [c83f58337e].

633
634
635
636
637
638
639












































640
641
642
643
644
645
646
 * \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







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
 * \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.
 *
 * \param selector The selector to perform
 * \param thread The thread on which to perform the selector
 * \param waitUntilDone Whether to wait until the perform finished
 */
- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	  waitUntilDone: (BOOL)waitUntilDone;

/**
 * \brief Performs the specified selector on the specified thread with the
 *	  specified object.
 *
 * \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 waitUntilDone Whether to wait until the perform finished
 */
- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	     withObject: (id)object
	  waitUntilDone: (BOOL)waitUntilDone;

/**
 * \brief Performs the specified selector on the specified thread with the
 *	  specified objects.
 *
 * \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 waitUntilDone Whether to wait until the perform finished
 */
- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	     withObject: (id)object1
	     withObject: (id)object2
	  waitUntilDone: (BOOL)waitUntilDone;

/**
 * \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

Modified src/OFObject.m from [5eddd9378d] to [5b25661283].

618
619
620
621
622
623
624

























































625
626
627
628
629
630
631

	[OFTimer scheduledTimerWithTimeInterval: delay
					 target: self
				       selector: selector
					 object: object1
					 object: object2
					repeats: NO];


























































	objc_autoreleasePoolPop(pool);
}

- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	     afterDelay: (double)delay







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688

	[OFTimer scheduledTimerWithTimeInterval: delay
					 target: self
				       selector: selector
					 object: object1
					 object: object2
					repeats: NO];

	objc_autoreleasePoolPop(pool);
}

- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	  waitUntilDone: (BOOL)waitUntilDone
{
	void *pool = objc_autoreleasePoolPush();
	OFTimer *timer = [OFTimer timerWithTimeInterval: 0
						 target: self
					       selector: selector
						repeats: NO];
	[[thread runLoop] addTimer: timer];

	if (waitUntilDone)
		[timer waitUntilDone];

	objc_autoreleasePoolPop(pool);
}

- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	     withObject: (id)object
	  waitUntilDone: (BOOL)waitUntilDone
{
	void *pool = objc_autoreleasePoolPush();
	OFTimer *timer = [OFTimer timerWithTimeInterval: 0
						 target: self
					       selector: selector
						 object: object
						repeats: NO];
	[[thread runLoop] addTimer: timer];

	if (waitUntilDone)
		[timer waitUntilDone];

	objc_autoreleasePoolPop(pool);
}

- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	     withObject: (id)object1
	     withObject: (id)object2
	  waitUntilDone: (BOOL)waitUntilDone
{
	void *pool = objc_autoreleasePoolPush();
	OFTimer *timer = [OFTimer timerWithTimeInterval: 0
						 target: self
					       selector: selector
						 object: object1
						 object: object2
						repeats: NO];
	[[thread runLoop] addTimer: timer];

	if (waitUntilDone)
		[timer waitUntilDone];

	objc_autoreleasePoolPop(pool);
}

- (void)performSelector: (SEL)selector
	       onThread: (OFThread*)thread
	     afterDelay: (double)delay