ObjFW  Check-in [c19b2b5726]

Overview
Comment:Remove +[OFThread sleepForTimeInterval:microseconds:].

Also fixes the forgotten change to double in +[sleepForTimeInterval:]
and fixes two warnings due to missing casts from double to uint32_t.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c19b2b5726f64b5ed668a46776e174d9f73142ea705bf0c05cf4b1bb173530a4
User & Date: js on 2011-09-17 20:17:43
Other Links: manifest | tags
Context
2011-09-17
20:22
Rename OFStream{Poll,Select}Observer to OFStreamObserver_{poll,select}. check-in: 4d2f08f6fe user: js tags: trunk
20:17
Remove +[OFThread sleepForTimeInterval:microseconds:]. check-in: c19b2b5726 user: js tags: trunk
19:18
Make hashes independant of endianess in OF{Float,Double}{Vector,Matrix}. check-in: f3db074478 user: js tags: trunk
Changes

Modified src/OFDate.m from [177828d4d1] to [0cf451e330].

371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
	[element autorelease];

	return element;
}

- (uint32_t)microsecond
{
	return nearbyint(remainder(seconds, 1) * 1000000);
}

- (uint8_t)second
{
	GMTIME_RET(tm_sec)
}








|







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
	[element autorelease];

	return element;
}

- (uint32_t)microsecond
{
	return (uint32_t)nearbyint(remainder(seconds, 1) * 1000000);
}

- (uint8_t)second
{
	GMTIME_RET(tm_sec)
}

Modified src/OFThread.h from [94d47672c0] to [f4f9d56218].

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

/**
 * \brief Suspends execution of the current thread for the specified time
 *	  interval.
 *
 * \param seconds The number of seconds to sleep
 */
+ (void)sleepForTimeInterval: (int64_t)seconds;

/**
 * \brief Suspends execution of the current thread for the specified time
 *	  interval.
 *
 * \param seconds The number of seconds to sleep
 * \param microseconds The number of microseconds to sleep
 */
+ (void)sleepForTimeInterval: (int64_t)seconds
		microseconds: (uint32_t)microseconds;

/**
 * \brief Suspends execution of the current thread until the specified date.
 *
 * \param date The date to wait for
 */
+ (void)sleepUntilDate: (OFDate*)date;







|
<
<
<
<
<
<
<
<
<
<







162
163
164
165
166
167
168
169










170
171
172
173
174
175
176

/**
 * \brief Suspends execution of the current thread for the specified time
 *	  interval.
 *
 * \param seconds The number of seconds to sleep
 */
+ (void)sleepForTimeInterval: (double)seconds;











/**
 * \brief Suspends execution of the current thread until the specified date.
 *
 * \param date The date to wait for
 */
+ (void)sleepUntilDate: (OFDate*)date;

Modified src/OFThread.m from [8714631aa6] to [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();