mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-23 03:44:13 +08:00
Remove unused RCTMessageQueue
Reviewed By: mhorowitz Differential Revision: D4564975 fbshipit-source-id: 62cb686fe5fefb4ec4a8f5db44898a95496420be
This commit is contained in:
committed by
Facebook Github Bot
parent
274e7ba592
commit
c529a06cb8
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <cxxreact/MessageQueueThread.h>
|
||||
#include <dispatch/dispatch.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class RCTMessageQueue : public MessageQueueThread {
|
||||
public:
|
||||
explicit RCTMessageQueue(const std::string &name);
|
||||
void runOnQueue(std::function<void()>&&) override;
|
||||
void runOnQueueSync(std::function<void()>&&) override;
|
||||
void quitSynchronous() override;
|
||||
|
||||
private:
|
||||
dispatch_queue_t m_queue;
|
||||
std::atomic_bool m_shutdown;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include "RCTMessageQueue.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
RCTMessageQueue::RCTMessageQueue(const std::string &name) {
|
||||
m_queue = dispatch_queue_create(name.c_str(), NULL);
|
||||
}
|
||||
|
||||
void RCTMessageQueue::runOnQueue(std::function<void()>&& func) {
|
||||
if (m_shutdown) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(m_queue, ^{
|
||||
if (!m_shutdown) {
|
||||
func();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void RCTMessageQueue::runOnQueueSync(std::function<void()>&& func) {
|
||||
if (m_shutdown) {
|
||||
return;
|
||||
}
|
||||
dispatch_sync(m_queue, ^{
|
||||
if (!m_shutdown) {
|
||||
func();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void RCTMessageQueue::quitSynchronous() {
|
||||
m_shutdown = true;
|
||||
dispatch_sync(m_queue, ^{});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user