Revert D2926896 WebWorkers: Move web worker impl to JSCExecutor

Reviewed By: lexs

Differential Revision: D2982150

fb-gh-sync-id: c75d05988df50b9788608e7c1bf00c4952ccfce1
shipit-source-id: c75d05988df50b9788608e7c1bf00c4952ccfce1
This commit is contained in:
Andy Street
2016-02-26 05:56:36 -08:00
committed by Facebook Github Bot 0
parent 50141f9d3f
commit c32e5fd84f
9 changed files with 312 additions and 229 deletions
@@ -2,9 +2,7 @@
#pragma once
#include <condition_variable>
#include <functional>
#include <mutex>
namespace facebook {
namespace react {
@@ -16,24 +14,6 @@ class MessageQueueThread {
virtual bool isOnThread() = 0;
// quitSynchronous() should synchronously ensure that no further tasks will run on the queue.
virtual void quitSynchronous() = 0;
void runOnQueueSync(std::function<void()>&& runnable) {
std::mutex signalMutex;
std::condition_variable signalCv;
bool runnableComplete = false;
runOnQueue([&] () mutable {
std::lock_guard<std::mutex> lock(signalMutex);
runnable();
runnableComplete = true;
signalCv.notify_one();
});
std::unique_lock<std::mutex> lock(signalMutex);
signalCv.wait(lock, [&runnableComplete] { return runnableComplete; });
}
};
}}