Differences From Artifact [67276b0c18]:
- File
src/OFThread.m
— part of check-in
[77780c7596]
at
2019-09-01 15:29:31
on branch trunk
— OFThread: Allow specifying a name before starting
This allows specifying a name before the thread gets started, so that
the name can be decided by whoever starts the thread, rather than just
by the thread itself once it's running.This is especially useful as some operating systems do not support
changing the name of the thread once it's running. (user: js, size: 10645) [annotate] [blame] [check-ins using]
To Artifact [590ace3cab]:
- File
src/OFThread.m
— part of check-in
[e702135e17]
at
2019-09-01 16:53:45
on branch trunk
— Remove remaining uses of lrint()
It was used to convert a time interval into seconds and microseconds or
seconds and nanoseconds and introduced inaccuracies. (user: js, size: 10588) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
82 83 84 85 86 87 88 | # import "OFThreadStillRunningException.h" #endif #ifdef OF_HAVE_ATOMIC_OPS # import "atomic.h" #endif | < < < < | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | # import "OFThreadStillRunningException.h" #endif #ifdef OF_HAVE_ATOMIC_OPS # import "atomic.h" #endif #if defined(OF_HAVE_THREADS) # import "tlskey.h" # if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) # import "socket.h" # endif static of_tlskey_t threadSelfKey; |
︙ | ︙ | |||
246 247 248 249 250 251 252 | @throw [OFOutOfRangeException exception]; svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | @throw [OFOutOfRangeException exception]; svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; rqtp.tv_nsec = (timeInterval - rqtp.tv_sec) * 1000000000; if (rqtp.tv_sec != trunc(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); #elif defined(OF_AMIGAOS) if (timeInterval * 50 > ULONG_MAX) |
︙ | ︙ | |||
271 272 273 274 275 276 277 | while (counter--) swiWaitForVBlank(); #else if (timeInterval > UINT_MAX) @throw [OFOutOfRangeException exception]; sleep((unsigned int)timeInterval); | | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | 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]; } |
︙ | ︙ |