views:

20

answers:

1

Hi,

I was looking through the Threading Programming which I have to say it's really good. Specially I was looking on How to configure Port-based input sources for running loops. And I see this piece of code

// Detach the thread. Let the worker release the port.
   [NSThread detachNewThreadSelector:@selector(LaunchThreadWithPort:)
           toTarget:[MyWorkerClass class] withObject:myPort];

I had understood everything 'til that. What is that function doing?, What is "LaunchThreadWithPort", What does "MyWorkerClass" standFor?.

I lack a bit of knowledge on @selectors, but It's not my main question. I really didn't understand a word about that function and what is doing there.

Thanks to anyone who replies.

+1  A: 

This piece of code basically tells the system to create a new thread that executes [[MyWorkerClass class] launchThreadWithPort: myPort]. The thread runs until this method returns.

Sven
And the method who launched the thread, continues the execution? or does it stop 'til the thread returns?
gvalero87
Yes, the method that calls this continues to run.
Sven