Re: Sublclassing NSThread
Re: Sublclassing NSThread
- Subject: Re: Sublclassing NSThread
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 16 Dec 2008 11:29:07 -0800
On Tue, Dec 16, 2008 at 9:29 AM, Brad O'Hearne
<email@hidden> wrote:
> Hello,
>
> I am trying to create an NSThread subclass which completely wraps the
> desired behavior of the thread execution.
I am sorry but what you described isn't making sense to me so I really
don't know how to answer your question. Can you restate it?
> As you can see, the initWithTarget: param is set to self, but the purpose of that statement is to set
> self, and self isn't defined yet to my knowledge
Inside of any instance method "self" exists (hidden parameter to the
method call) and points to the instance that received the message. In
"init" methods you do the self = [super initXxxx]; to deal with the
super implementation possibly swapping the original instance out for
another instance (see Cocoa does on initializers).
If you sub-class NSThread you override -main to provide the
implementation for the code that will run in the thread context. I am
not sure why you want/think you need to override -start.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden