Differences From Artifact [4151197f7a]:
- File src/OFThread.m — part of check-in [3b97fc3cd9] at 2014-01-04 00:24:08 on branch trunk — Update copyright. (user: js, size: 7382) [annotate] [blame] [check-ins using]
To Artifact [bbc593cb97]:
- File
src/OFThread.m
— part of check-in
[dc31ce3d34]
at
2014-01-16 23:09:11
on branch trunk
— Add of_time_interval_t.
This is used instead for time intervals now instead of doubles. (user: js, size: 7455) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
171 172 173 174 175 176 177 | if (thread->_threadDictionary == nil) thread->_threadDictionary = [[OFMutableDictionary alloc] init]; return thread->_threadDictionary; } #endif | | | | | | | | | | | > | 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 206 207 208 209 210 211 | if (thread->_threadDictionary == nil) thread->_threadDictionary = [[OFMutableDictionary alloc] init]; return thread->_threadDictionary; } #endif + (void)sleepForTimeInterval: (of_time_interval_t)timeInterval { if (timeInterval < 0) @throw [OFOutOfRangeException exception]; #if defined(_WIN32) if (timeInterval * 1000 > UINT_MAX) @throw [OFOutOfRangeException exception]; Sleep((unsigned int)(timeInterval * 1000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; 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)); #endif } + (void)sleepUntilDate: (OFDate*)date { [self sleepForTimeInterval: [date timeIntervalSinceNow]]; } |
︙ | ︙ |