0

Apart from ASIHTTPRequest and using NSOperations what other ways are there to implement Multithreading? Please provide a link if there are any other ways to implement multithreading. Also can we implement multithreading for AudioStreaming to retrieve from url..

DShah
  • 9,768
  • 11
  • 71
  • 127

1 Answers1

0

Take a look at this method:

[NSThread detachNewThreadSelector:@selector(entryPointMethodForSecondThread) toTarget:objectWhereEntryPMethodDeclarated withObject:nil];

Note that you must create an autorelease pool for it in 'entry point method'. The details check in the specification of NSThread.

makaron
  • 1,585
  • 2
  • 16
  • 30
  • So we can create thread using NSThread and you mean that we can also call another in other seperate thread??? – DShah Jul 29 '11 at 12:58
  • NSThread here is a class. It has a static method detachNewThreadSelector:toTarget:withObject: . It will create a new thread (whereas your active one will go on), starting it with function you will pass to 'toTarget' parameter. Don't forget to create an autorelease pool in that function. – makaron Jul 29 '11 at 13:02
  • ok but I want to know that the method entrypointMethodForSecondThread will be executed in seperate Thread??? – DShah Jul 29 '11 at 13:06
  • 1
    Yes :) Your main (or active) thread will pass the line I provided in answer, proceeding its work; The second thread will be created at that line and will start its work from entrypointMethodForSecondThread. – makaron Jul 29 '11 at 13:08