fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2 Co-authored-by: Sebastian McKenzie <sebmck@fb.com> Co-authored-by: John Knox <jknox@fb.com> Co-authored-by: Emil Sjölander <emilsj@fb.com> Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
40 lines
748 B
Objective-C
40 lines
748 B
Objective-C
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
* file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
#if FB_SONARKIT_ENABLED
|
|
|
|
#pragma once
|
|
|
|
#import <dispatch/dispatch.h>
|
|
|
|
namespace facebook {
|
|
namespace sonar {
|
|
class DispatchQueue
|
|
{
|
|
public:
|
|
virtual void async(dispatch_block_t block) = 0;
|
|
};
|
|
|
|
class GCDQueue: public DispatchQueue
|
|
{
|
|
public:
|
|
GCDQueue(dispatch_queue_t underlyingQueue)
|
|
:_underlyingQueue(underlyingQueue) { }
|
|
|
|
void async(dispatch_block_t block) override
|
|
{
|
|
dispatch_async(_underlyingQueue, block);
|
|
}
|
|
|
|
private:
|
|
dispatch_queue_t _underlyingQueue;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|