0

For several reasons, I would like to make my application backwards compatible to OS X 10.5.

Until now, I am using lots of GCD dispatch queues added in 10.6 like so:

dispatch_async(dispatch_get_main_queue(), ^{
    [self setStatusText:@"Connection established, waiting for response ..."
               withType:STATUS_MSG_INFO];

});

What would be the easiest alternative so that I don't have to re-write all the code?

Suggestions welcome! Thanks in advance!

JWWalker
  • 22,385
  • 6
  • 55
  • 76
guitarflow
  • 2,930
  • 25
  • 38

1 Answers1

2

How about the following NSObject method:

- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait
Paul Dardeau
  • 2,589
  • 1
  • 13
  • 10
  • Yeah, I know that one, you can't execute larger blocks though. But I think that's a drawback I'm gonna have to handle ... What about if I need something on a different thread? Is there something such as thread-pooling in OS X prior to 10.6? – guitarflow Aug 09 '13 at 20:25
  • With performSelectorXXX, you would be using method calls instead of blocks. I'm not aware of stock thread pooling, but there are probably open-source solutions that provide them. – Paul Dardeau Aug 09 '13 at 20:27
  • I was just wondering how you would call the method mentioned above (with more than one argument), found an easy solution here: http://stackoverflow.com/questions/5299629/performselectorinbackground-with-multiple-params – guitarflow Aug 09 '13 at 20:53
  • What about `NSOperationQueue`? – BergQuester Aug 09 '13 at 22:05