ObjFW  Diff

Differences From Artifact [edfcfa680d]:

To Artifact [878e01b6fc]:


70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84







-
+







		OFThreadStateRunning,
		OFThreadStateWaitingForJoin
	} _running;
# ifndef OF_OBJFW_RUNTIME
	void *_pool;
# endif
# ifdef OF_HAVE_BLOCKS
	OFThreadBlock _Nullable _threadBlock;
	OFThreadBlock _Nullable _block;
# endif
	jmp_buf _exitEnv;
	id _returnValue;
	bool _supportsSockets;
	OFRunLoop *_Nullable _runLoop;
	OFMutableDictionary *_threadDictionary;
	OFString *_Nullable _name;
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128







-
+







 */
@property OF_NULLABLE_PROPERTY (copy) OFString *name;

# ifdef OF_HAVE_BLOCKS
/**
 * @brief The block to execute in the thread.
 */
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFThreadBlock threadBlock;
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFThreadBlock block;
# endif

/**
 * @brief The run loop for the thread.
 */
@property (readonly, nonatomic) OFRunLoop *runLoop;

160
161
162
163
164
165
166
167

168
169
170

171
172
173
174
175
176
177
160
161
162
163
164
165
166

167
168
169

170
171
172
173
174
175
176
177







-
+


-
+







 */
+ (instancetype)thread;

# ifdef OF_HAVE_BLOCKS
/**
 * @brief Creates a new thread with the specified block.
 *
 * @param threadBlock A block which is executed by the thread
 * @param block A block which is executed by the thread
 * @return A new, autoreleased thread
 */
+ (instancetype)threadWithThreadBlock: (OFThreadBlock)threadBlock;
+ (instancetype)threadWithBlock: (OFThreadBlock)block;
# endif

/**
 * @brief Returns the current thread.
 *
 * @return The current thread
 */
199
200
201
202
203
204
205



206
207
208
209

210
211
212
213
214
215
216
199
200
201
202
203
204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219







+
+
+



-
+







 */
+ (nullable OFMutableDictionary *)threadDictionary;
#endif

#ifdef OF_HAVE_SOCKETS
/**
 * @brief Returns the DNS resolver for the current thread.
 *
 * Constructs the DNS resolver is there is none yet, unless @ref currentThread
 * is `nil`, in which case it returns `nil`.
 *
 * @return The DNS resolver for the current thread
 */
+ (OFDNSResolver *)DNSResolver;
+ (nullable OFDNSResolver *)DNSResolver;
#endif

/**
 * @brief Suspends execution of the current thread for the specified time
 *	  interval.
 *
 * @param timeInterval The number of seconds to sleep
260
261
262
263
264
265
266
267

268
269
270

271
272
273
274
275
276
277
263
264
265
266
267
268
269

270
271
272

273
274
275
276
277
278
279
280







-
+


-
+







 */
+ (nullable OFString *)name;

# ifdef OF_HAVE_BLOCKS
/**
 * @brief Initializes an already allocated thread with the specified block.
 *
 * @param threadBlock A block which is executed by the thread
 * @param block A block which is executed by the thread
 * @return An initialized OFThread.
 */
- (instancetype)initWithThreadBlock: (OFThreadBlock)threadBlock;
- (instancetype)initWithBlock: (OFThreadBlock)block;
# endif

/**
 * @brief The main routine of the thread. You need to reimplement this!
 *
 * @return The object the join method should return when called for this thread
 */