@@ -16,12 +16,51 @@ #include "config.h" #import "OFThreadStillRunningException.h" #import "OFString.h" + +#import "OFNotImplementedException.h" @implementation OFThreadStillRunningException ++ 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; @@ -29,6 +68,11 @@ @"Deallocation of a thread of type %@ was tried, even though it " @"was still running!", inClass]; return description; } + +- (OFThread*)thread +{ + return thread; +} @end