gvalero87
gvalero87

Reputation: 875

NSThread detachNewThreadSelector???? uh?

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.

Upvotes: 0

Views: 1962

Answers (1)

anon
anon

Reputation:

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.

Upvotes: 1

Related Questions