Skip to content

Commit

Permalink
Avoid an unnecessary lock & unlock pair in ASMainSerialQueue (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhuy committed Mar 16, 2019
1 parent 34f1621 commit e3ae663
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Source/Details/ASMainSerialQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ - (NSUInteger)numberOfScheduledBlocks

- (void)performBlockOnMainThread:(dispatch_block_t)block
{

AS::UniqueLock l(_serialQueueLock);
[_blocks addObject:block];
{
l.unlock();
[self runBlocks];
l.lock();
AS::MutexLocker l(_serialQueueLock);
[_blocks addObject:block];
}

[self runBlocks];
}

- (void)runBlocks
Expand Down

0 comments on commit e3ae663

Please sign in to comment.