ObjFW  Diff

Differences From Artifact [8714631aa6]:

To Artifact [95ced5e160]:


154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
}

+ (OFThread*)currentThread
{
	return [[of_tlskey_get(threadSelf) retain] autorelease];
}

+ (void)sleepForTimeInterval: (int64_t)seconds
{
	if (seconds < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	if (seconds > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	sleep((unsigned int)seconds);

#else
	if (seconds * 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep((unsigned int)seconds * 1000);
#endif
}

+ (void)sleepForTimeInterval: (int64_t)seconds
		microseconds: (uint32_t)microseconds
{
	if (seconds < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	sleep((unsigned int)seconds);
	usleep(microseconds);
#else
	if (seconds * 1000 + microseconds / 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep((unsigned int)seconds * 1000 + microseconds / 1000);
#endif
}

+ (void)sleepUntilDate: (OFDate*)date
{
	double seconds = [date timeIntervalSinceNow];

#ifndef _WIN32
	if (seconds > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	sleep((unsigned int)seconds);
	usleep(nearbyint(remainder(seconds, 1) * 1000000));
#else
	if (seconds * 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep(seconds * 1000);
#endif
}

+ (void)yield
{
#ifdef OF_HAVE_SCHED_YIELD
	sched_yield();







|









>




|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












|




|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

















177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
}

+ (OFThread*)currentThread
{
	return [[of_tlskey_get(threadSelf) retain] autorelease];
}

+ (void)sleepForTimeInterval: (double)seconds
{
	if (seconds < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	if (seconds > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	sleep((unsigned int)seconds);
	usleep((uint32_t)nearbyint(remainder(seconds, 1) * 1000000));
#else
	if (seconds * 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep((unsigned int)(seconds * 1000));

















#endif
}

+ (void)sleepUntilDate: (OFDate*)date
{
	double seconds = [date timeIntervalSinceNow];

#ifndef _WIN32
	if (seconds > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	sleep((unsigned int)seconds);
	usleep((uint32_t)nearbyint(remainder(seconds, 1) * 1000000));
#else
	if (seconds * 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep((unsigned int)(seconds * 1000));
#endif
}

+ (void)yield
{
#ifdef OF_HAVE_SCHED_YIELD
	sched_yield();