@@ -99,14 +99,32 @@ [super dealloc]; } @end @implementation OFTLSKey ++ tlsKey +{ + return [[[self alloc] init] autorelease]; +} + + tlsKeyWithDestructor: (void(*)(id))destructor { return [[[self alloc] initWithDestructor: destructor] autorelease]; } + +- init +{ + self = [super init]; + + if (!of_tlskey_new(&key, NULL)) { + Class c = isa; + [super dealloc]; + @throw [OFInitializationFailedException newWithClass: c]; + } + + return self; +} - initWithDestructor: (void(*)(id))destructor { self = [super init];