> On Jan 13, 2015, at 9:57 AM, Mike Abdullah <mabdul...@karelia.com> wrote:
> 
> 
>> On 13 Jan 2015, at 16:18, Mike Abdullah <mabdul...@karelia.com> wrote:
>> 
>> 
>>> On 13 Jan 2015, at 16:07, Raglan T. Tiger <r...@crusaderrabbit.net> wrote:
>>> 
>>> I allocate and init an NSThread as follows:
>>> 
>>>      if ( m_mythread ) [m_mythread cancel];
>>>      m_mythread = [[MYThread alloc] initWithTarget:m_mythread 
>>> selector:@selector(start) object:m_anobject];
>>>      [m_mythread start];
> 
> Looking closer, I have to wonder what you think this code will do. You seem 
> to be trying to create a thread that will message *itself* to do its work.

Not only that, but I bet it infinite loops restarting itself. 

1. Use init, not initWithTarget.
2. Override -main to do your threaded work.

corbin


> At the time this code is executed, m_mythread will either be nil, or will 
> point to an older thread instance that you’re about to supersede.
> 
> I think you need to take a step back and evaluate your app design. What are 
> you actually trying to accomplish here? Would using NSOperationQueue or GCD 
> better suit your needs?
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
> 
> This email sent to corb...@apple.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to