1

I wish to block a background thread until my main thread's run loop is sleeping (aka the main thread is waiting for input).

I think I can do this by doing:

[self performSelectorOnMainThread:@selector(waitSelector) withObject:nil waitUntilDone:TRUE];

However I do believe there is probably a better way of doing this. Any advice?

thewormsterror
  • 1,608
  • 14
  • 27
  • What do you do in `waitSelector` ? – borrrden Feb 19 '13 at 10:12
  • nothing, i was just using the waitUntilDone aspect – thewormsterror Feb 19 '13 at 10:14
  • So basically, you just want to wait until the next run loop? – borrrden Feb 19 '13 at 10:17
  • well not really, right now I am triggering the next run loop on the main thread by performing a selector on the main thread. In an optimal scenario I wouldn't trigger the next run loop, just wait for the current one to finish on the main thread. Since a run loop is mostly sleeping until input triggers it, I would like to wait in my background thread till the next time the main thread run loop is sleeping without triggering a cycle on the main thread run loop. – thewormsterror Feb 19 '13 at 10:32

0 Answers0