ObjFW  Check-in [9a623a35d0]

Overview
Comment:Add OFMutex(Lock|Unlock)FailedException and fix a few FIXMEs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9a623a35d0089b63441cf9ca9fa8adf3598f11718d09ed8b4310be52cbf2a214
User & Date: js on 2009-11-13 18:42:41
Other Links: manifest | tags
Context
2009-11-13
18:53
Resolve more FIXMEs. check-in: f1637e9310 user: js tags: trunk
18:42
Add OFMutex(Lock|Unlock)FailedException and fix a few FIXMEs. check-in: 9a623a35d0 user: js tags: trunk
18:29
Add -[hash] for OFList. check-in: eb67bc40fa user: js tags: trunk
Changes

Modified src/OFExceptions.h from [06d4aa94e1] to [dcad64c6f9].

683
684
685
686
687
688
689












@end

/**
 * An OFException indicating that the thread has been canceled.
 */
@interface OFThreadCanceledException: OFException {}
@end



















>
>
>
>
>
>
>
>
>
>
>
>
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
@end

/**
 * An OFException indicating that the thread has been canceled.
 */
@interface OFThreadCanceledException: OFException {}
@end

/**
 * An OFException indicating that locking a mutex failed.
 */
@interface OFMutexLockFailedException: OFException {}
@end

/**
 * An OFException indicating that unlocking a mutex failed.
 */
@interface OFMutexUnlockFailedException: OFException {}
@end

Modified src/OFExceptions.m from [a73fec2e41] to [5a256fa7d9].

992
993
994
995
996
997
998
999
1000
1001


























	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The requested action cannot be performed because the thread of "
	    @"class %s was canceled!", [class_ className]];

	return string;
}
@end




































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The requested action cannot be performed because the thread of "
	    @"class %s was canceled!", [class_ className]];

	return string;
}
@end

@implementation OFMutexLockFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"A mutex could not be locked in class %s", [class_ className]];

	return string;
}
@end

@implementation OFMutexUnlockFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"A mutex could not be unlocked in class %s", [class_ className]];

	return string;
}
@end

Modified src/OFThread.m from [a317ee9371] to [40c1edc042].

163
164
165
166
167
168
169
170
171

172
173
174
175
176
177
178
179

180
181
182
183
184
185
186
187
188
189
190
191
	}

	return self;
}

- lock
{
	/* FIXME: Add error-handling */
	of_mutex_lock(&mutex);


	return self;
}

- unlock
{
	/* FIXME: Add error-handling */
	of_mutex_unlock(&mutex);


	return self;
}

- (void)dealloc
{
	/* FIXME: Add error-handling */
	of_mutex_free(&mutex);

	[super dealloc];
}
@end







<
|
>






<
|
>






<





163
164
165
166
167
168
169

170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185

186
187
188
189
190
	}

	return self;
}

- lock
{

	if (!of_mutex_lock(&mutex))
		@throw [OFMutexLockFailedException newWithClass: isa];

	return self;
}

- unlock
{

	if (!of_mutex_unlock(&mutex))
		@throw [OFMutexUnlockFailedException newWithClass: isa];

	return self;
}

- (void)dealloc
{

	of_mutex_free(&mutex);

	[super dealloc];
}
@end