> LOGGING FROM DIFFERENT BACKGROUND THREADS AT ONCE<p>Or, you could just make a logging serial queue that you send all log messages to; that way there's no risk of activity on the main thread slowing down your logging. In (Obj-)C:<p><pre><code> static queue_t queue;
void log (NSString *message) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
queue = dispatch_queue_create("logging", DISPATCH_QUEUE_SERIAL);
});
dispatch_async(queue, ^{
NSLog(message);
});
}</code></pre>