RuntimeExecutor: Remove noexcept from sync ui thread utils (#51514)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51514

This util can execute arbitrary runtimeWork, which can throw.

In the future, we'll also make these utils execute ui blocks posted from the javascript thread. And those will be able to throw.

Therefore, let's remove the noexcept. Otherwise, if an exception bubbles up to this util, it will just crash this app.

Changelog: [General][Changed] - RuntimeExecutor:  Remove noexcept from sync ui thread utils

Reviewed By: javache

Differential Revision: D75183993

fbshipit-source-id: 6c3a319fe3a76165a265815e6343220cf9db6fde
This commit is contained in:
Ramanpreet Nara
2025-05-27 12:21:04 -07:00
committed by Facebook GitHub Bot
parent 4974839be9
commit 7ef278af50
@@ -43,7 +43,7 @@ using RuntimeExecutor =
*/
inline static void executeSynchronouslyOnSameThread_CAN_DEADLOCK(
const RuntimeExecutor& runtimeExecutor,
std::function<void(jsi::Runtime&)>&& runtimeWork) noexcept {
std::function<void(jsi::Runtime&)>&& runtimeWork) {
std::promise<jsi::Runtime*> runtime;
std::promise<void> runtimeCaptureBlockDone;
std::promise<void> runtimeWorkDone;
@@ -75,7 +75,7 @@ inline static void executeSynchronouslyOnSameThread_CAN_DEADLOCK(
template <typename DataT>
inline static DataT executeSynchronouslyOnSameThread_CAN_DEADLOCK(
const RuntimeExecutor& runtimeExecutor,
std::function<DataT(jsi::Runtime& runtime)>&& runtimeWork) noexcept {
std::function<DataT(jsi::Runtime& runtime)>&& runtimeWork) {
DataT data;
executeSynchronouslyOnSameThread_CAN_DEADLOCK(