ObjFW  Check-in [aa6143bdf1]

Overview
Comment:OFThread: Use Delay() on MorphOS + libnix
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aa6143bdf12c49e3ed9a842b7ad708f86505f178392a1930ea184a34fe47b3bd
User & Date: js on 2017-05-28 17:56:16
Other Links: manifest | tags
Context
2017-05-28
18:57
Separate std{out,err} on MorphOS + libnix check-in: 0dabf9dc62 user: js tags: trunk
17:56
OFThread: Use Delay() on MorphOS + libnix check-in: aa6143bdf1 user: js tags: trunk
17:45
Do not set SIGPIPE handler on MorphOS + libnix check-in: 74bcc11aac user: js tags: trunk
Changes

Modified src/OFThread.m from [9edbd0db22] to [d1aa6904ee].

26
27
28
29
30
31
32






33
34
35
36
37
38
39

#ifdef OF_HAVE_SCHED_YIELD
# include <sched.h>
#endif
#include "unistd_wrapper.h"

#include "platform.h"







#ifdef OF_WII
# define BOOL OGC_BOOL
# define nanosleep ogc_nanosleep
# include <ogcsys.h>
# undef BOOL
# undef nanosleep







>
>
>
>
>
>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#ifdef OF_HAVE_SCHED_YIELD
# include <sched.h>
#endif
#include "unistd_wrapper.h"

#include "platform.h"

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
#endif

#ifdef OF_WII
# define BOOL OGC_BOOL
# define nanosleep ogc_nanosleep
# include <ogcsys.h>
# undef BOOL
# undef nanosleep
185
186
187
188
189
190
191





192
193
194
195
196
197
198
	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;







>
>
>
>
>







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
	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_MORPHOS) && !defined(OF_IXEMUL)
	if (timeInterval * 50 > ULONG_MAX)
		@throw [OFOutOfRangeException exception];

	Delay(timeInterval * 50);
#elif defined(OF_NINTENDO_DS)
	uint64_t counter;

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

	counter = timeInterval * 60;