ObjFW  Check-in [e5240d68e8]

Overview
Comment:Don't require OFCopying protocol for the thread's object.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e5240d68e899507ab6d3ceeec2e171e6b934f8ec65719d569b1f2e2e1eda8900
User & Date: js on 2010-04-11 17:43:28
Other Links: manifest | tags
Context
2010-04-11
17:55
Add -[remoteAddress] to OFTCPSocket. check-in: 04dc76c8c3 user: js tags: trunk
17:43
Don't require OFCopying protocol for the thread's object. check-in: e5240d68e8 user: js tags: trunk
17:16
Allow OFAddressTranslationFailedExceptions without service and node. check-in: 6b22a15485 user: js tags: trunk
Changes

Modified src/OFThread.h from [f1900f7431] to [25914ccb95].

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	id retval;
}

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return A new autoreleased thread
 */
+ threadWithObject: (OFObject <OFCopying>*)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.







|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	id retval;
}

/**
 * \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.
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 */
+ (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: (OFObject <OFCopying>*)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.
 *







|







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 */
+ (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.
 *

Modified src/OFThread.m from [6d271824f0] to [06743d152c].

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	if (self != [OFThread class])
		return;

	if (!of_tlskey_new(&thread_self))
		@throw [OFInitializationFailedException newWithClass: self];
}

+ threadWithObject: (OFObject <OFCopying>*)obj
{
	return [[[self alloc] initWithObject: obj] autorelease];
}

+ setObject: (OFObject*)obj
  forTLSKey: (OFTLSKey*)key
{







|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	if (self != [OFThread class])
		return;

	if (!of_tlskey_new(&thread_self))
		@throw [OFInitializationFailedException newWithClass: self];
}

+ threadWithObject: (id)obj
{
	return [[[self alloc] initWithObject: obj] autorelease];
}

+ setObject: (OFObject*)obj
  forTLSKey: (OFTLSKey*)key
{
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

- init
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithObject: (OFObject <OFCopying>*)obj
{
	self = [super init];

	object = [obj retain];

	return self;
}







|







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

- init
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithObject: (id)obj
{
	self = [super init];

	object = [obj retain];

	return self;
}