ObjFW  Diff

Differences From Artifact [21b3bcf0e5]:

  • File src/OFThread.m — part of check-in [82b11a2992] at 2014-04-08 18:48:57 on branch trunk — Partly revert 4a8704e

    This actually caused more trouble than it fixed. The real reason was
    that _POSIX_TIMERS wasn't defined and thus nanosleep() would not be
    declared by time.h. libogc however also provides nanosleep(), but an
    incompatible one that we don't really want. So after _POSIX_TIMERS has
    been defined, it would actually conflict, as both declarations would be
    used then. This removes the special handling for Wii and uses the
    nanosleep() from time.h, which has a declaration that is compatible with
    POSIX. (user: js, size: 7486) [annotate] [blame] [check-ins using]

To Artifact [d65d9ab0c1]:


45
46
47
48
49
50
51






52
53
54
55
56
57
58
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64







+
+
+
+
+
+







#import "OFDictionary.h"
#import "OFAutoreleasePool.h"
#import "OFAutoreleasePool+Private.h"

#ifdef _WIN32
# include <windows.h>
#endif

#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm
#endif

#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfRangeException.h"
#ifdef OF_HAVE_THREADS
# import "OFThreadJoinFailedException.h"
191
192
193
194
195
196
197









198
199
200
201
202
203
204
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219







+
+
+
+
+
+
+
+
+







	rqtp.tv_sec = (time_t)timeInterval;
	rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000);

	if (rqtp.tv_sec != floor(timeInterval))
		@throw [OFOutOfRangeException exception];

	nanosleep(&rqtp, NULL);
#elif defined(OF_NINTENDO_DS)
	uint64_t counter;

	if (timeInterval > UINT64_MAX / 60)
		@throw [OFOutOfRangeException exception];

	counter = timeInterval * 60;
	while (counter--)
		swiWaitForVBlank();
#else
	if (timeInterval > UINT_MAX)
		@throw [OFOutOfRangeException exception];

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