Re: NSThread
Re: NSThread
- Subject: Re: NSThread
- From: "Raglan T. Tiger" <email@hidden>
- Date: Tue, 13 Jan 2015 19:53:15 -0700
I am using all this good advice to attempt to unwrap myself and the axle.
I shall return.
-rags
> On Jan 13, 2015, at 2:09 PM, Corbin Dunn <email@hidden> wrote:
>
>>
>> On Jan 13, 2015, at 9:57 AM, Mike Abdullah <email@hidden> wrote:
>>
>>
>>> On 13 Jan 2015, at 16:18, Mike Abdullah <email@hidden> wrote:
>>>
>>>
>>>> On 13 Jan 2015, at 16:07, Raglan T. Tiger <email@hidden> 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 (email@hidden <mailto: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 <http://lists.apple.com/>
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden <mailto:email@hidden>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden <mailto: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 <http://lists.apple.com/>
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden <mailto:email@hidden>
_______________________________________________
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