ObjFW  Diff

Differences From Artifact [0049adfd9b]:

To 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]


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# include <sched.h>
#endif

#if defined(OF_HAVE_THREADS) && defined(__HAIKU__)
# include <kernel/OS.h>
#endif

#ifdef __wii__
# define BOOL OGC_BOOL
# define asm __asm__
# include <ogcsys.h>
# undef BOOL
# undef asm
#endif

#import "OFThread.h"
#import "OFThread+Private.h"
#import "OFRunLoop.h"
#import "OFList.h"
#import "OFDate.h"
#import "OFDictionary.h"
#import "OFAutoreleasePool.h"







<
<
<
<
<
<
<
<







33
34
35
36
37
38
39








40
41
42
43
44
45
46
# include <sched.h>
#endif

#if defined(OF_HAVE_THREADS) && defined(__HAIKU__)
# include <kernel/OS.h>
#endif









#import "OFThread.h"
#import "OFThread+Private.h"
#import "OFRunLoop.h"
#import "OFList.h"
#import "OFDate.h"
#import "OFDictionary.h"
#import "OFAutoreleasePool.h"
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217

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

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

# ifndef __wii__
	nanosleep(&rqtp, NULL);
# else
	/* Wii has an incompatible nanosleep */
	nanosleep(&rqtp);
# endif
#else
	if (timeInterval > UINT_MAX)
		@throw [OFOutOfRangeException exception];

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







<

<
<
<
<







190
191
192
193
194
195
196

197




198
199
200
201
202
203
204

	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);




#else
	if (timeInterval > UINT_MAX)
		@throw [OFOutOfRangeException exception];

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