RE: Threading problem using AsyncSocket
RE: Threading problem using AsyncSocket
- Subject: RE: Threading problem using AsyncSocket
- From: "Matthew Youney" <email@hidden>
- Date: Thu, 14 Aug 2008 16:34:04 -0400
- Importance: Normal
Jack,
Sorry for the confusion, my e-mail program (outlook) capitalized the R. It
is indedd rLoop in my code.
Matt
-----Original Message-----
From: Jack Carbaugh [mailto:email@hidden]
Sent: Thursday, August 14, 2008 4:30 PM
To: Matthew Youney
Subject: Re: Threading problem using AsyncSocket
rLoop and RLoop are two different items i believe.
since you define rLoop, try
rLoop.run
On Aug 14, 2008, at Thu-08 /14 /08-4:20 PM, Matthew Youney wrote:
> Actually, I think you are correct, however I am still missing
> something....
>
> I have added the code:
>
> NSRunLoop *rLoop [NSRunLoop currentRunLoop];
> RLoop.run;
>
> And still no delegate methods firing. Can you or someone please
> direct me to a resource or an example of setting up a run loop
> appropriate for a worker thread?
>
> Again, thanks,
> Matt
>
>
> -----Original Message-----
> From: email@hidden
> [mailto:email@hidden]On Behalf Of Marcelo Alves
> Sent: Thursday, August 14, 2008 2:55 PM
> To: email@hidden
> Subject: Re: Threading problem using AsyncSocket
>
> I think you need a runloop in the worker thread.
>
>
> 2008/8/14 Matthew Youney <email@hidden>:
>>
>> Hello list,
>> This is my first attempt at threading with Cocoa, and I am having
>> difficulty
>> with my classes that use AsyncSocket. I am using
>> DetachNewThreadSelector:
>> to detach my 'worker' thread, and I am instantiating my class that
>> uses
>> AsyncSocket from within this thread. The problem is that the
>> AsyncSocket
>> delegates are never called. This class works just fine from the main
>> thread.
>>
>> - (IBAction)RunTestButtonPressed:(id)sender
>> {
>> [NSThread detachNewThreadSelector:
>> @selector(threadFunction:)
>> toTarget: self withObject: recipe];
>> }
>>
>>
>> - (void) threadFunction:(BeverageRecipe*)recipe
>> {
>> ClassContainingAsyncSocket* foo;
>> int i=0;
>>
>> while (stuffTodo)
>> {
>> NSAutoreleasePool* autoReleasePool=[[NSAutoreleasePool alloc]init];
>>
>> foo=[[ ClassContainingAsyncSocket alloc]init];
>>
>> i=[foo readRegister:0]; //none of the AsyncSocket
>> delegates
>> 'fire!'
>>
>> [autoReleasePool release];
>>
>>
>> do more stuff....
>> }
>>
>> }
>>
>>
>> Does anyone have any idea what I am missing? Something
>> fundamentally wrong?
>> Thanks in advance for any and all assistance.
>>
>> Matt
>> _______________________________________________
>>
>> 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:
>>
c
>>
>> This email sent to 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
_______________________________________________
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