Fabric: Using `executeSynchronouslyOnSameThread_CAN_DEADLOCK` in MainRunLoopEventBeat
Summary: We are replacing inline-ed implementation with practically the same one implemented as the helper method. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D20551409 fbshipit-source-id: fcc6f497cd240af65fba534051c217fe5746ce82
This commit is contained in:
Родитель
15ea60e3a8
Коммит
8d3d8afa5b
|
@ -58,30 +58,7 @@ void MainRunLoopEventBeat::lockExecutorAndBeat() const
|
|||
return;
|
||||
}
|
||||
|
||||
// Note: We need the third mutex to get back to the main thread before
|
||||
// the lambda is finished (because all mutexes are allocated on the stack).
|
||||
std::mutex mutex1;
|
||||
std::mutex mutex2;
|
||||
std::mutex mutex3;
|
||||
|
||||
mutex1.lock();
|
||||
mutex2.lock();
|
||||
mutex3.lock();
|
||||
|
||||
jsi::Runtime *runtimePtr;
|
||||
|
||||
runtimeExecutor_([&](jsi::Runtime &runtime) {
|
||||
runtimePtr = &runtime;
|
||||
mutex1.unlock();
|
||||
// `beat` is called somewhere here.
|
||||
mutex2.lock();
|
||||
mutex3.unlock();
|
||||
});
|
||||
|
||||
mutex1.lock();
|
||||
beat(*runtimePtr);
|
||||
mutex2.unlock();
|
||||
mutex3.lock();
|
||||
executeSynchronouslyOnSameThread_CAN_DEADLOCK(runtimeExecutor_, [this](jsi::Runtime &runtime) { beat(runtime); });
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
|
|
Загрузка…
Ссылка в новой задаче