ObjFW  Diff

Differences From Artifact [5063c8614f]:

To Artifact [8e9159db32]:


21
22
23
24
25
26
27

28
29
30
31
32
33
34
# include <sched.h>
#else
# include <windows.h>
#endif

#import "OFThread.h"
#import "OFList.h"

#import "OFAutoreleasePool.h"
#import "OFExceptions.h"

#import "threading.h"

static OFList *tlskeys;
static of_tlskey_t thread_self;







>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# include <sched.h>
#else
# include <windows.h>
#endif

#import "OFThread.h"
#import "OFList.h"
#import "OFDate.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"

#import "threading.h"

static OFList *tlskeys;
static of_tlskey_t thread_self;
99
100
101
102
103
104
105





















106
107
108
109
110
111
112
{
#ifndef _WIN32
	usleep(msecs * 1000);
#else
	Sleep(msecs);
#endif
}






















+ (void)yield
{
#ifndef _WIN32
	sched_yield();
#else
	Sleep(0);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
133
134
{
#ifndef _WIN32
	usleep(msecs * 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
	usleep(sec * 1000000 + usec);
#else
	Sleep(sec * 1000 + usec / 1000);
#endif
}

+ (void)yield
{
#ifndef _WIN32
	sched_yield();
#else
	Sleep(0);