• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Threading problem using AsyncSocket (Matthew Youney)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threading problem using AsyncSocket (Matthew Youney)


  • Subject: Re: Threading problem using AsyncSocket (Matthew Youney)
  • From: "email@hidden" <email@hidden>
  • Date: Thu, 14 Aug 2008 22:03:45 +0100

I don't know about your threading problem but surely the whole point of AsyncSocket is the Async bit.
It is designed to attach itself to the runloop and remove the need for blocking sockets etc on threads.


I use AsyncSocket extensively within the main thread and it can handle multiple connection without any problem.


Hello list,
This is my first attempt at threading with Cocoa, and I am having difficu=
lty
with my classes that use AsyncSocket. I am using DetachNewThreadSelector=
:
to detach my =91worker=92 thread, and I am instantiating my class that us=
es
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=3D0;

           while (stuffTodo)
           {
NSAutoreleasePool* autoReleasePool=3D[[NSAutoreleasePool alloc]init];

           foo=3D[[ ClassContainingAsyncSocket alloc]init];

i=3D[foo readRegister:0]; //none of the AsyncSocket delegate=
s
=91fire!=92


           [autoReleasePool release];


do more stuff=85. }

}


Does anyone have any idea what I am missing? Something fundamentally wro=
ng?
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:
This email sent to email@hidden


  • Follow-Ups:
    • RE: Threading problem using AsyncSocket (Matthew Youney)
      • From: "Matthew Youney" <email@hidden>
  • Prev by Date: Re: drawRect is erasing view
  • Next by Date: Re: @try @catch
  • Previous by thread: Re: drawRect is erasing view
  • Next by thread: RE: Threading problem using AsyncSocket (Matthew Youney)
  • Index(es):
    • Date
    • Thread