Alaa Eldin
Alaa Eldin

Reputation: 2268

Fire another thread inside For Loop iphone

is there any equivalent function to thread::yield() in the iOS 4.2 ?

for ()
{
    thread::yield();//go track other events
}

I tried to use NSRunLoop but I'm beginner and I'm not full aware of it.

Thanks in advance.

Upvotes: 0

Views: 144

Answers (2)

David Dunham
David Dunham

Reputation: 8339

In general, just do the work you want in a thread. Let the OS schedule things.

It's also easier not to explicitly use threads, but instead use Grand Central Dispatch in some form — NSOperationQueue is a good way to do so.

Upvotes: 0

Eric Petroelje
Eric Petroelje

Reputation: 60549

Not directly, but you could use the NSThread method sleepForTimeInterval: with a very small interval to do effectively the same thing.

Upvotes: 1

Related Questions