ObjFW  Check-in [8e84561642]

Overview
Comment:OFThread: Use unsigned int instead of useconds_t

useconds_t isn't always available and an unsigned int always satisfies
the range we require here.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8e84561642fea5b896de97dc763a4f311bbed6b061aa099bbfe179117aa22534
User & Date: js on 2017-05-17 22:07:03
Other Links: manifest | tags
Context
2017-05-17
22:14
typedef socklen_t to int on MorphOS check-in: d302df8b46 user: js tags: trunk
22:07
OFThread: Use unsigned int instead of useconds_t check-in: 8e84561642 user: js tags: trunk
20:31
configure: Better poll() and select() checks check-in: a29197bd35 user: js tags: trunk
Changes

Modified src/OFThread.m from [666629e8be] to [3b9d6bd50a].

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

#ifdef OF_HAVE_ATOMIC_OPS
# import "atomic.h"
#endif

#ifdef __DJGPP__
# define lrint(x) rint(x)
# define useconds_t unsigned int
#endif

#ifdef OF_HAVE_THREADS
# import "threading.h"

static of_tlskey_t threadSelfKey;
static OFThread *mainThread;







<







83
84
85
86
87
88
89

90
91
92
93
94
95
96

#ifdef OF_HAVE_ATOMIC_OPS
# import "atomic.h"
#endif

#ifdef __DJGPP__
# define lrint(x) rint(x)

#endif

#ifdef OF_HAVE_THREADS
# import "threading.h"

static of_tlskey_t threadSelfKey;
static OFThread *mainThread;
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

	svcSleepThread((int64_t)(timeInterval * 1000000000));
#else
	if (timeInterval > UINT_MAX)
		@throw [OFOutOfRangeException exception];

	sleep((unsigned int)timeInterval);
	usleep((useconds_t)lrint(
	    (timeInterval - floor(timeInterval)) * 1000000));
#endif
}

+ (void)sleepUntilDate: (OFDate *)date
{
	[self sleepForTimeInterval: [date timeIntervalSinceNow]];







|







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226

	svcSleepThread((int64_t)(timeInterval * 1000000000));
#else
	if (timeInterval > UINT_MAX)
		@throw [OFOutOfRangeException exception];

	sleep((unsigned int)timeInterval);
	usleep((unsigned int)lrint(
	    (timeInterval - floor(timeInterval)) * 1000000));
#endif
}

+ (void)sleepUntilDate: (OFDate *)date
{
	[self sleepForTimeInterval: [date timeIntervalSinceNow]];