1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 */ 7 8 #pragma once 9 10 #include <condition_variable> 11 #include <functional> 12 #include <mutex> 13 14 namespace ABI48_0_0facebook { 15 namespace ABI48_0_0React { 16 17 class MessageQueueThread { 18 public: ~MessageQueueThread()19 virtual ~MessageQueueThread() {} 20 virtual void runOnQueue(std::function<void()> &&) = 0; 21 // runOnQueueSync and quitSynchronous are dangerous. They should only be 22 // used for initialization and cleanup. 23 virtual void runOnQueueSync(std::function<void()> &&) = 0; 24 // Once quitSynchronous() returns, no further work should run on the queue. 25 virtual void quitSynchronous() = 0; 26 }; 27 28 } // namespace ABI48_0_0React 29 } // namespace ABI48_0_0facebook 30