ObjFW  Diff

Differences From Artifact [8e9159db32]:

To Artifact [ea45b83ab4]:


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
129
130
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
129
130
131
132







-
+
+




















+
-
+







{
	return of_tlskey_get(thread_self);
}

+ (void)sleepForNMilliseconds: (unsigned int)msecs;
{
#ifndef _WIN32
	usleep(msecs * 1000);
	sleep(msecs / 1000);
	usleep((msecs % 1000) * 1000);
#else
	Sleep(msecs);
#endif
}

+ (void)sleepUntilDate: (OFDate*)date
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFDate *now = [OFDate date];
	int64_t sec;
	uint32_t usec;

	if ((sec = [date timeIntervalSinceDate: now]) < 0)
		@throw [OFOutOfRangeException newWithClass: self];

	usec = [date microsecondsOfTimeIntervalSinceDate: now];

	[pool release];

#ifndef _WIN32
	sleep(sec);
	usleep(sec * 1000000 + usec);
	usleep(usec);
#else
	Sleep(sec * 1000 + usec / 1000);
#endif
}

+ (void)yield
{