Differences From Artifact [7d209d5958]:
- File
src/OFThread.m
— part of check-in
[5b37fbeb82]
at
2020-12-20 21:26:08
on branch trunk
— Return error instead of using errno for threading
errno is problematic for Amiga libraries and is also not thread-safe on
some systems, even though it should. (user: js, size: 10869) [annotate] [blame] [check-ins using] [more...]
To Artifact [05e44b8885]:
- File
src/OFThread.m
— part of check-in
[d6050881b4]
at
2020-12-23 13:41:38
on branch trunk
— Do not use nanosleep() on AmigaOS / MorphOS
This is yet another function that would need to be passed from the
linklib to the .library. (user: js, size: 11142) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | Sleep((unsigned int)(timeInterval * 1000)); #elif defined(OF_NINTENDO_3DS) if (timeInterval * 1000000000 > INT64_MAX) @throw [OFOutOfRangeException exception]; svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; rqtp.tv_nsec = (long)((timeInterval - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != trunc(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); | > > > > > > > > > > > < < < < < | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | Sleep((unsigned int)(timeInterval * 1000)); #elif defined(OF_NINTENDO_3DS) if (timeInterval * 1000000000 > INT64_MAX) @throw [OFOutOfRangeException exception]; svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(OF_AMIGAOS) struct timerequest request = *DOSBase->dl_TimeReq; request.tr_node.io_Message.mn_ReplyPort = &((struct Process *)FindTask(NULL))->pr_MsgPort; request.tr_node.io_Command = TR_ADDREQUEST; request.tr_time.tv_secs = (ULONG)timeInterval; request.tr_time.tv_micro = (ULONG) ((timeInterval - (unsigned int)timeInterval) * 1000000); DoIO((struct IORequest *)&request); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; rqtp.tv_nsec = (long)((timeInterval - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != trunc(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((unsigned int) ((timeInterval - (unsigned int)timeInterval) * 1000000)); #endif } + (void)sleepUntilDate: (OFDate *)date { [self sleepForTimeInterval: date.timeIntervalSinceNow]; } |
︙ | ︙ |