mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-02 20:55:48 +00:00
no message
This commit is contained in:
parent
fbe9635411
commit
9b88e5d46d
@ -10,6 +10,7 @@
|
||||
|
||||
- (void)dispatch:(dispatch_block_t)block;
|
||||
- (void)dispatchSync:(dispatch_block_t)block;
|
||||
- (void)dispatch:(dispatch_block_t)block synchronous:(bool)synchronous;
|
||||
|
||||
- (dispatch_queue_t)_dispatch_queue;
|
||||
|
||||
|
||||
@ -98,6 +98,20 @@ static const void *SQueueSpecificKey = &SQueueSpecificKey;
|
||||
dispatch_sync(_queue, block);
|
||||
}
|
||||
|
||||
- (void)dispatch:(dispatch_block_t)block synchronous:(bool)synchronous {
|
||||
if (_queueSpecific != NULL && dispatch_get_specific(SQueueSpecificKey) == _queueSpecific)
|
||||
block();
|
||||
else if (_specialIsMainQueue && [NSThread isMainThread])
|
||||
block();
|
||||
else {
|
||||
if (synchronous) {
|
||||
dispatch_sync(_queue, block);
|
||||
} else {
|
||||
dispatch_async(_queue, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (bool)isCurrentQueue
|
||||
{
|
||||
if (_queueSpecific != NULL && dispatch_get_specific(SQueueSpecificKey) == _queueSpecific)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user