Detach thread in executeAsynchronously (RuntimeExecutor.h) (#31090)

Summary:
std::thread's constructor is nodiscard. This breaks in MSVC 16.9 when nodiscard starts to be enforced. Either we should hold on to the created object or detach the temporary which is what I think this function intends to do anyway.

Fixes https://github.com/facebook/react-native/issues/31088

Fixes an invalid usage of std::thread's constructor

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - fixes usage of std::thread in runtime executor

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

Reviewed By: sammy-SC

Differential Revision: D26783963

Pulled By: appden

fbshipit-source-id: fed4d072792aafa058dd742e8fce30a207f991c1
This commit is contained in:
Alexander Sklar 2021-03-04 12:41:24 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 7e81c1d483
Коммит 75d9ba733f
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -39,9 +39,9 @@ using RuntimeExecutor =
inline static void executeAsynchronously(
RuntimeExecutor const &runtimeExecutor,
std::function<void(jsi::Runtime &runtime)> &&callback) noexcept {
std::thread{[callback = std::move(callback), runtimeExecutor]() mutable {
std::thread([callback = std::move(callback), runtimeExecutor]() mutable {
runtimeExecutor(std::move(callback));
}};
}).detach();
}
/*