Skip to content

Commit 75d9ba7

Browse files
asklarfacebook-github-bot
authored andcommitted
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 #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: #31090 Reviewed By: sammy-SC Differential Revision: D26783963 Pulled By: appden fbshipit-source-id: fed4d072792aafa058dd742e8fce30a207f991c1
1 parent 7e81c1d commit 75d9ba7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ using RuntimeExecutor =
3939
inline static void executeAsynchronously(
4040
RuntimeExecutor const &runtimeExecutor,
4141
std::function<void(jsi::Runtime &runtime)> &&callback) noexcept {
42-
std::thread{[callback = std::move(callback), runtimeExecutor]() mutable {
42+
std::thread([callback = std::move(callback), runtimeExecutor]() mutable {
4343
runtimeExecutor(std::move(callback));
44-
}};
44+
}).detach();
4545
}
4646

4747
/*

0 commit comments

Comments
 (0)