You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SignalServiceKit/src/Util/Threading.m

23 lines
376 B
Objective-C

//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "Threading.h"
NS_ASSUME_NONNULL_BEGIN
void DispatchMainThreadSafe(SimpleBlock block)
{
OWSCAssert(block);
if ([NSThread isMainThread]) {
block();
} else {
dispatch_async(dispatch_get_main_queue(), ^{
block();
});
}
}
NS_ASSUME_NONNULL_END