@@ -16,12 +16,51 @@ #include "config.h" #import "OFThreadStartFailedException.h" #import "OFString.h" + +#import "OFNotImplementedException.h" @implementation OFThreadStartFailedException ++ newWithClass: (Class)class_ + thread: (OFThread*)thread +{ + return [[self alloc] initWithClass: class_ + thread: thread]; +} + +- initWithClass: (Class)class_ +{ + Class c = isa; + [self release]; + @throw [OFNotImplementedException newWithClass: c + selector: _cmd]; +} + +- initWithClass: (Class)class_ + thread: (OFThread*)thread_ +{ + self = [super initWithClass: class_]; + + @try { + thread = [thread_ retain]; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + [thread release]; + + [super dealloc]; +} + - (OFString*)description { if (description != nil) return description; @@ -28,6 +67,11 @@ description = [[OFString alloc] initWithFormat: @"Starting a thread of class %@ failed!", inClass]; return description; } + +- (OFThread*)thread +{ + return thread; +} @end