ObjFW  Diff

Differences From Artifact [e6a6c3857f]:

To Artifact [022999c179]:


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
133
134
135
136
137
138
139
140
141
142
143
144



145
146
147



148
149
150
151
152
153
154

+ (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];
	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(usec);
#else



	Sleep(sec * 1000 + usec / 1000);
#endif
}

+ (void)yield
{
#ifdef OF_HAVE_SCHED_YIELD







>
>
>
|

|
>
>
>










|


|
>
>
>


















>
>
>
|


>
>
>







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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

+ (void)sleepForTimeInterval: (int64_t)sec
{
	if (sec < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	if (sec > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	sleep((unsigned int)sec);
#else
	if (sec * 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep((unsigned int)sec * 1000);
#endif
}

+ (void)sleepForTimeInterval: (int64_t)sec
		microseconds: (uint32_t)usec
{
	if (sec < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	sleep((unsigned int)sec);
	usleep(usec);
#else
	if (sec * 1000 + usec / 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep((unsigned int)sec * 1000 + usec / 1000);
#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
	if (sec > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	sleep((unsigned int)sec);
	usleep(usec);
#else
	if (sec * 1000 + usec / 1000 > UINT_MAX)
		@throw [OFOutOfRangeException newWithClass: self];

	Sleep(sec * 1000 + usec / 1000);
#endif
}

+ (void)yield
{
#ifdef OF_HAVE_SCHED_YIELD