92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
}
+ (OFThread*)currentThread
{
return of_tlskey_get(thread_self);
}
+ (void)sleepForNMilliseconds: (unsigned int)msecs;
{
#ifndef _WIN32
sleep(msecs / 1000);
usleep((msecs % 1000) * 1000);
#else
Sleep(msecs);
#endif
}
+ (void)sleepUntilDate: (OFDate*)date
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDate *now = [OFDate date];
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
}
+ (OFThread*)currentThread
{
return of_tlskey_get(thread_self);
}
+ (void)sleepForTimeInterval: (int64_t)sec
{
if (sec < 0)
@throw [OFOutOfRangeException newWithClass: self];
#ifndef _WIN32
sleep(sec);
#else
Sleep(sec * 1000);
#endif
}
+ (void)sleepForTimeInterval: (int64_t)sec
microseconds: (uint32_t)usec
{
if (sec < 0)
@throw [OFOutOfRangeException newWithClass: self];
#ifndef _WIN32
sleep(sec);
usleep(usec);
#else
Sleep(sec * 1000 + usec / 1000);
#endif
}
+ (void)sleepUntilDate: (OFDate*)date
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDate *now = [OFDate date];
|