ObjFW  Check-in [3c6ad38d92]

Overview
Comment:Make it possible to stop run loops.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3c6ad38d92211554291c9c7b3f8600aa2cb89daf1dfc3075fec45c4cabce1ce3
User & Date: js on 2013-01-13 14:59:08
Other Links: manifest | tags
Context
2013-01-13
16:10
exception.m: Handle empty class names. check-in: ebaf70c292 user: js tags: trunk
14:59
Make it possible to stop run loops. check-in: 3c6ad38d92 user: js tags: trunk
13:07
Add of_char{16,32}_t. check-in: 545b6f740e user: js tags: trunk
Changes

Modified src/OFRunLoop.h from [1730eaf461] to [c69434c2e7].

33
34
35
36
37
38
39

40
41
42
43
44
45
46
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47







+







{
	OFSortedList *timersQueue;
#ifdef OF_HAVE_THREADS
	OFMutex *timersQueueLock;
#endif
	OFStreamObserver *streamObserver;
	OFMutableDictionary *readQueues;
	BOOL running;
}

/*!
 * @brief Returns the main run loop.
 *
 * @return The main run loop
 */
97
98
99
100
101
102
103






104
98
99
100
101
102
103
104
105
106
107
108
109
110
111







+
+
+
+
+
+


- (void)OF_removeTimer: (OFTimer*)timer;

/*!
 * @brief Starts the run loop.
 */
- (void)run;

/*!
 * @brief Stops the run loop. If there is still an operation being executed, it
 *	  is finished before the run loop stops.
 */
- (void)stop;
@end

Modified src/OFRunLoop.m from [9373453d76] to [9ee569b5cb].

581
582
583
584
585
586
587

588


589
590
591
592
593
594
595
581
582
583
584
585
586
587
588

589
590
591
592
593
594
595
596
597







+
-
+
+







#endif
	} else
		OF_ENSURE(0);
}

- (void)run
{
	running = YES;
	for (;;) {

	while (running) {
		void *pool = objc_autoreleasePoolPush();
		OFDate *now = [OFDate date];
		OFTimer *timer;
		OFDate *nextTimer;

#ifdef OF_HAVE_THREADS
		[timersQueueLock lock];
643
644
645
646
647
648
649






650
645
646
647
648
649
650
651
652
653
654
655
656
657
658







+
+
+
+
+
+

			 */
			[streamObserver observe];
		}

		objc_autoreleasePoolPop(pool);
	}
}

- (void)stop
{
	running = NO;
	[streamObserver cancel];
}
@end