문제

I saw some handwarmer apps and I guess it's very easy to make something like that by running multiple processes at once. Has anyone had a go on it? If you did, can you share it with us here?

도움이 되었습니까?

해결책

Just find some endlessly repeating calculation (like something that finds the digits in Pi for example), and launch three or four threads performing them - either an NSOperationQueue with a concurrent count set to four, or just spawn off threads yourself.

The key is to make the system work in some way, you can either exercise the CPU or the GPU (or both).

다른 팁

You can easily spawn several threads:

- (void) reticulateSplines {
    while (1) ;
}

- (void) spawnThreads {
    for (int i=0; i<kNumberOfThreads; i++)
        [self performSelectorInBackground:@selector(reticulateSplines)
              withObject:nil];
}

That’s not several processes and probably does not warm the machine up, though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top