[ffi] Add dartdoc comment for NativeCallable.isolateGroupBound
Fixes https://github.com/dart-lang/sdk/issues/61839 TEST=ci Change-Id: I00df20eb8c08eef111bed55c31a7cb71c851ab03 CoreLibraryReviewExempt: vm-only doc change Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457884 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
committed by
Commit Queue
parent
36d9e4e77b
commit
0cf5b99c4f
@@ -396,6 +396,30 @@ abstract final class NativeCallable<T extends Function> {
|
||||
throw UnsupportedError("NativeCallable cannot be constructed dynamically.");
|
||||
}
|
||||
|
||||
/// Constructs a [NativeCallable] that can be invoked from any thread.
|
||||
///
|
||||
/// When the native code invokes the function [nativeFunction],
|
||||
/// the [callback] will be executed within the isolate group
|
||||
/// of the [Isolate] which originally constructed the callable.
|
||||
/// Specifically, this means that an attempt to access any
|
||||
/// static or global field which is not shared between
|
||||
/// isolates in a group will result in a [Error].
|
||||
///
|
||||
/// If an exception is thrown by the [callback], the
|
||||
/// native function will return the `exceptionalReturn`,
|
||||
/// which must be assignable to the return type of
|
||||
/// the [callback].
|
||||
///
|
||||
/// [callback] and [exceptionalReturn] must be
|
||||
/// _trivially shareable_.
|
||||
///
|
||||
/// This callback must be [close]d when it is no longer
|
||||
/// needed. An [Isolate] that created the callback will
|
||||
/// be kept alive until [close] is called.
|
||||
///
|
||||
/// After [NativeCallable.close] is called, invoking
|
||||
/// the [nativeFunction] from native code will cause
|
||||
/// undefined behavior.
|
||||
factory NativeCallable.isolateGroupBound(
|
||||
@DartRepresentationOf("T") Function callback, {
|
||||
Object? exceptionalReturn,
|
||||
|
||||
Reference in New Issue
Block a user