From fd67962b5bb00ab98689c983fcca31d1c8cce044 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Thu, 7 Dec 2023 19:53:19 +0000 Subject: [PATCH] Add note advising caution when using host task that captures by reference --- adoc/chapters/programming_interface.adoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 64520352..68a5e158 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -14622,6 +14622,15 @@ interoperability member functions provided by the [code]#interop_handle# class. Local <> cannot be used within a <>. +[NOTE] +==== +If a C++ lambda is passed to a <>, the lambda may capture by +reference or by value. +Since the <> callable executes asynchronously, care must be taken to +ensure that lifetimes of objects captured by reference by a <> lambda +last at least until the <> completes. +==== + // TODO: access mode/target resolution rules [source,,linenums]