ObjFW  Check-in [219a630ef0]

Overview
Comment:Replace -[sleepForNMilliseconds:] with -[sleepForTimeInterval:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 219a630ef055233eeeeea5ffa433774a367937c109cfcff9688b4495e1bc0d7b
User & Date: js on 2011-01-11 22:03:25
Other Links: manifest | tags
Context
2011-01-11
22:43
Fix missing retain + autorelease in TLS-object handling. (check-in: e9e263d62a user: js tags: trunk)
22:03
Replace -[sleepForNMilliseconds:] with -[sleepForTimeInterval:]. (check-in: 219a630ef0 user: js tags: trunk)
21:56
Some systems don't allow usleep for values > 1000000. (check-in: 2fb2ff521f user: js tags: trunk)
Changes

Modified src/OFThread.h from [0e4696b05c] to [fdc4c85c01].

110
111
112
113
114
115
116
117



118








119


120
121
122
123
124
125
126
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







-
+
+
+

+
+
+
+
+
+
+
+
-
+
+








/**
 * \return The current thread or nil if we are in the main thread
 */
+ (OFThread*)currentThread;

/**
 * Suspends execution of the current thread for N milliseconds.
 * Suspends execution of the current thread for the specified time interval.
 *
 * \param sec The number of seconds to sleep
 */
+ (void)sleepForTimeInterval: (int64_t)sec;

/**
 * Suspends execution of the current thread for the specified time interval.
 *
 * \param sec The number of seconds to sleep
 * \param usec The number of microseconds to sleep
 */
+ (void)sleepForNMilliseconds: (unsigned int)msecs;
+ (void)sleepForTimeInterval: (int64_t)sec
		microseconds: (uint32_t)usec;

/**
 * Suspends execution of the current thread until the specified date.
 */
+ (void)sleepUntilDate: (OFDate*)date;

/**

Modified src/OFThread.m from [ea45b83ab4] to [907c5a1a16].

92
93
94
95
96
97
98
99

100



101
102
103















104
105

106
107
108
109
110
111
112
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)sleepForNMilliseconds: (unsigned int)msecs;
+ (void)sleepForTimeInterval: (int64_t)sec
{
	if (sec < 0)
		@throw [OFOutOfRangeException newWithClass: self];

#ifndef _WIN32
	sleep(msecs / 1000);
	usleep((msecs % 1000) * 1000);
	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(msecs);
	Sleep(sec * 1000 + usec / 1000);
#endif
}

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