Differences From Artifact [b35e0e98a2]:
- File src/OFThread.m — part of check-in [35dafd5c57] at 2013-11-23 01:12:40 on branch trunk — Add OF_INVALID_INIT_METHOD. (user: js, size: 7300) [annotate] [blame] [check-ins using]
To Artifact [b5e162fd36]:
- File
src/OFThread.m
— part of check-in
[bd2389b6b8]
at
2013-11-30 19:53:16
on branch trunk
— OFThread.m: Move #ifdefs.
The reason is that the symbol nanosleep is available now on Win32, but
is part of the pthreads wrapper, which we don't use. (user: js, size: 7299) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
171 172 173 174 175 176 177 | #endif + (void)sleepForTimeInterval: (double)seconds { if (seconds < 0) @throw [OFOutOfRangeException exception]; | > > > > > | | < < < < < | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | #endif + (void)sleepForTimeInterval: (double)seconds { if (seconds < 0) @throw [OFOutOfRangeException exception]; #if defined(_WIN32) if (seconds * 1000 > UINT_MAX) @throw [OFOutOfRangeException exception]; Sleep((unsigned int)(seconds * 1000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)seconds; rqtp.tv_nsec = lrint((seconds - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != floor(seconds)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); #else if (seconds > UINT_MAX) @throw [OFOutOfRangeException exception]; sleep((unsigned int)seconds); usleep((useconds_t)lrint((seconds - floor(seconds)) * 1000000)); #endif } + (void)sleepUntilDate: (OFDate*)date { [self sleepForTimeInterval: [date timeIntervalSinceNow]]; } |
︙ | ︙ |