Re: self release
Re: self release
- Subject: Re: self release
- From: Danny Swarzman <email@hidden>
- Date: Mon, 12 May 2003 14:16:30 -0700
I guess that I shouldn't have said 'factory'. The thing about threads is
that there doesn't need to be a management of threads outside of what the
system provides. The notion that the object which creates threads must also
delete the thread doesn't always work.
You may want threads that behave like tasks that are 'spawned'. The parent
may not be there when the spawned task dies. This kind of asymetric
behavior is often the best way to do things. It's very common in Java.
-Danny Swarzman
At 13:35 -0700 5/12/03, Wolfgang Ante wrote:
>
> I disagree with this! The best way to handle this is a Wolfgang first
>
> stated. Of course there should be comments in the right places.
>
>
Hm, interesting discussion. Although not about [self release] anymore.
>
:-)
>
>
> A factory method to create the object have a comment saying that these
>
> objects are released in the suicide method.
>
>
And not autoreleased? Like this:
>
>
MyWorkingBee *bee = [MyWorkingBee workingBeeWithWorkDesc:info];
>
// now it stays...
>
[bee runInBackgroundAndRelease];
>
// and now it goes...
>
>
I think a factory method should always return autoreleased objects.
>
>
I agree if you meant an init method, like here:
>
>
MyWorkingBee *bee = [[MyWorkingBee alloc] initWithWorkDesc:info];
>
[bee runInBackground];
>
[bee release];
>
>
This is just for the "looks": From looking at this snippet it looks
>
like not leaking.
>
>
Or like sinclair44 suggested:
>
>
MyWorkingBee *bee = [[MyWorkingBee alloc] initWithWorkDesc:info];
>
[bee runInBackgroundAndReleaseWhenDone];
>
>
Although I don't like it, personally.
>
>
Well, I better stop now, I think I am beating this topic to death... ;-)
>
>
Bye, Wolfgang :-)
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.