Move SKTigonNetwork internal plugin to xplat
Summary: Moves SKTigonNetwork internal plugin to xplat leaving behind a stub buck target in litho Reviewed By: passy Differential Revision: D9082339 fbshipit-source-id: d98eeef4e64458586403c01937f6d48ad82e27aa
This commit is contained in:
committed by
Facebook Github Bot
parent
7a82d56eb6
commit
0b0f59f096
@@ -0,0 +1,48 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#if FB_SONARKIT_ENABLED
|
||||
|
||||
#pragma once
|
||||
|
||||
#import <SonarKitNetworkPlugin/SKDispatchQueue.h>
|
||||
|
||||
#import <vector>
|
||||
|
||||
namespace facebook {
|
||||
namespace sonar {
|
||||
class SyncQueue: public DispatchQueue
|
||||
{
|
||||
public:
|
||||
SyncQueue()
|
||||
:_isSuspended(NO){}
|
||||
|
||||
void async(dispatch_block_t block) override
|
||||
{
|
||||
if (_isSuspended) {
|
||||
_blockArray.push_back(block);
|
||||
} else {
|
||||
block();
|
||||
}
|
||||
}
|
||||
|
||||
void suspend()
|
||||
{
|
||||
_isSuspended = YES;
|
||||
}
|
||||
|
||||
void resume()
|
||||
{
|
||||
_isSuspended = NO;
|
||||
for (const auto &block : _blockArray) {
|
||||
block();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<dispatch_block_t> _blockArray;
|
||||
bool _isSuspended;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user