ios7 - NSThread High CPU usage -
im trying using continually running thread perform tasks @ high rate in app. in app have list of 1000 or time stamps. poll them until it's time , instruct ausampler play.
the problem have seem fundamentally not understand how nsthread works. in simple example below cpu shoots 100% despite no tasks being run.
in way using nsthread incorrectly? better way create a fast polling mechanism doesnt hog cpu?
mythread =[[nsthread alloc]initwithtarget:self selector:@selector(test) object:nil]; [audiothread setthreadpriority:0]; [audiothread start]; -(void)test { while(mycondition) { // work // cpu == 100% } }
the solution find minimum interval between sampler fire times (based on bpm/ resolution) , make thread sleep amount.
Comments
Post a Comment