ObjFW  Diff

Differences From Artifact [a4a4af59a1]:

To Artifact [035bd5514f]:


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	of_tlskey_t key;
/* Work around a bug in gcc 4.4.4 (possibly only on Haiku) */
#if !defined(__GNUC__) || __GNUC__ != 4 || __GNUC_MINOR__ != 4 || \
    __GNUC_PATCHLEVEL__ != 4
@protected
#endif
	void (*destructor)(id);
	of_list_object_t *listobj;
	BOOL initialized;
}

/**
 * \return A new autoreleased Thread Local Storage key
 */
+ TLSKey;







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	of_tlskey_t key;
/* Work around a bug in gcc 4.4.4 (possibly only on Haiku) */
#if !defined(__GNUC__) || __GNUC__ != 4 || __GNUC_MINOR__ != 4 || \
    __GNUC_PATCHLEVEL__ != 4
@protected
#endif
	void (*destructor)(id);
	of_list_object_t *listObject;
	BOOL initialized;
}

/**
 * \return A new autoreleased Thread Local Storage key
 */
+ TLSKey;
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
	of_thread_t thread;
@public
	enum {
		OF_THREAD_NOT_RUNNING,
		OF_THREAD_RUNNING,
		OF_THREAD_WAITING_FOR_JOIN
	} running;
	id retval;
}

/**
 * \return A new, autoreleased thread
 */
+ thread;

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return A new, autoreleased thread
 */
+ threadWithObject: (id)obj;

/**
 * Sets the Thread Local Storage for the specified key.
 *
 * The specified object is first retained and then the object stored before is
 * released. You can specify nil as object if you want the old object to be
 * released and don't want any new object for the TLS key.
 *
 * \param key The Thread Local Storage key
 * \param obj The object the Thread Local Storage key will be set to
 */
+ (void)setObject: (id)obj
	forTLSKey: (OFTLSKey*)key;

/**
 * Returns the object for the specified Thread Local Storage key.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \param key The Thread Local Storage key
 */
+ (id)objectForTLSKey: (OFTLSKey*)key;

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

/**
 * 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)sleepForTimeInterval: (int64_t)sec
		microseconds: (uint32_t)usec;

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

/**







|











|











|




















|

|




|
|

|
|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
	of_thread_t thread;
@public
	enum {
		OF_THREAD_NOT_RUNNING,
		OF_THREAD_RUNNING,
		OF_THREAD_WAITING_FOR_JOIN
	} running;
	id returnValue;
}

/**
 * \return A new, autoreleased thread
 */
+ thread;

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return A new, autoreleased thread
 */
+ threadWithObject: (id)object;

/**
 * Sets the Thread Local Storage for the specified key.
 *
 * The specified object is first retained and then the object stored before is
 * released. You can specify nil as object if you want the old object to be
 * released and don't want any new object for the TLS key.
 *
 * \param key The Thread Local Storage key
 * \param obj The object the Thread Local Storage key will be set to
 */
+ (void)setObject: (id)object
	forTLSKey: (OFTLSKey*)key;

/**
 * Returns the object for the specified Thread Local Storage key.
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \param key The Thread Local Storage key
 */
+ (id)objectForTLSKey: (OFTLSKey*)key;

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

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

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

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

/**
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+ (void)terminate;

/**
 * Terminates the current thread, letting it return the specified object.
 *
 * \param obj The object which the terminated thread will return
 */
+ (void)terminateWithObject: (id)obj;

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return An initialized OFThread.
 */
- initWithObject: (id)obj;

/**
 * The main routine of the thread. You need to reimplement this!
 *
 * It can access the object passed to the threadWithObject or initWithObject
 * method using the instance variable named object.
 *







|





|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
+ (void)terminate;

/**
 * Terminates the current thread, letting it return the specified object.
 *
 * \param obj The object which the terminated thread will return
 */
+ (void)terminateWithObject: (id)object;

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return An initialized OFThread.
 */
- initWithObject: (id)object;

/**
 * The main routine of the thread. You need to reimplement this!
 *
 * It can access the object passed to the threadWithObject or initWithObject
 * method using the instance variable named object.
 *
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244

/**
 * \brief A class implementing a condition variable for thread synchronization.
 */
@interface OFCondition: OFMutex
{
	of_condition_t condition;
	BOOL cond_initialized;
}

/**
 * \return A new, autoreleased OFCondition
 */
+ condition;








|







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244

/**
 * \brief A class implementing a condition variable for thread synchronization.
 */
@interface OFCondition: OFMutex
{
	of_condition_t condition;
	BOOL conditionInitialized;
}

/**
 * \return A new, autoreleased OFCondition
 */
+ condition;