ObjFW  Check-in [2193480a94]

Overview
Comment:Create the current OFRunLoop on demand.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2193480a94b7740a2aa6d42bf49e80fa2ded23ed58c567a2c60fe4b9cbd79754
User & Date: js on 2012-09-14 07:03:49
Other Links: manifest | tags
Context
2012-09-15
12:20
OFThread: Implement the OFCopying protocol. check-in: 2929f89f3e user: js tags: trunk
2012-09-14
07:03
Create the current OFRunLoop on demand. check-in: 2193480a94 user: js tags: trunk
06:09
Add -[OFObject performSelector:afterDelay:]. check-in: 5e067285c8 user: js tags: trunk
Changes

Modified src/OFRunLoop.m from [317802665c] to [5d28216a68].

86
87
88
89
90
91
92
93
94









95
96
97
98
99


100
101
102
103
104
105
106
86
87
88
89
90
91
92


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115







-
-
+
+
+
+
+
+
+
+
+





+
+







+ (OFRunLoop*)mainRunLoop
{
	return [[mainRunLoop retain] autorelease];
}

+ (OFRunLoop*)currentRunLoop
{
	return [[[OFThread objectForTLSKey: currentRunLoopKey]
	    retain] autorelease];
	OFRunLoop *runLoop = [OFThread objectForTLSKey: currentRunLoopKey];

	if (runLoop == nil) {
		runLoop = [[OFRunLoop alloc] init];
		[OFThread setObject: runLoop
			  forTLSKey: currentRunLoopKey];
	}

	return [[runLoop retain] autorelease];
}

+ (void)_setMainRunLoop: (OFRunLoop*)mainRunLoop_
{
	mainRunLoop = [mainRunLoop_ retain];
	[OFThread setObject: mainRunLoop
		  forTLSKey: currentRunLoopKey];
}

#ifdef OF_HAVE_BLOCKS
+ (void)_addAsyncReadForStream: (OFStream*)stream
			buffer: (void*)buffer
			length: (size_t)length
			 block: (of_stream_async_read_block_t)block
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
174
175
176
177
178
179
180



181
182
183
184
185
186
187







-
-
-







		timersQueue = [[[OFThread currentThread] _timersQueue] retain];

		streamObserver = [[OFStreamObserver alloc] init];
		[streamObserver setDelegate: self];

		readQueues = [[OFMutableDictionary alloc] init];

		[OFThread setObject: self
			  forTLSKey: currentRunLoopKey];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;