Skip to content

Commit

Permalink
[ffi] Fix mistake in NativeCallable.isolateLocal documentation.
Browse files Browse the repository at this point in the history
NativeCallable.isolateLocal *does* keep the isolate alive by default.
This was changed during review of the original CL, but the documentation
wasn't updated.

I've just copied the wording from `NativeCallable.listener` to make them
totally consistent.

Bug: #54294
Fixes: #54294
Change-Id: I2953da648f34b0a3cf1eb0fefb8edb2cccb0bf8d
CoreLibraryReviewExempt: FFI is VM-only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343980
Auto-Submit: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
  • Loading branch information
liamappelbe authored and Commit Queue committed Dec 29, 2023
1 parent 2be26a7 commit 55c8bc8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sdk/lib/ffi/ffi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ abstract final class NativeCallable<T extends Function> {
/// Unlike [Pointer.fromFunction], [NativeCallable]s can be constructed from
/// any Dart function or closure, not just static or top level functions.
///
/// This callback must be [close]d when it is no longer needed, but it will
/// *not* keep its [Isolate] alive. After the isolate is terminated, or
/// [NativeCallable.close] is called, invoking the [nativeFunction] from
/// This callback must be [close]d when it is no longer needed. The [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.isolateLocal(
@DartRepresentationOf("T") Function callback,
Expand All @@ -214,6 +214,8 @@ abstract final class NativeCallable<T extends Function> {
///
/// This callback must be [close]d when it is no longer needed. The [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.
///
/// For example:
///
Expand Down

0 comments on commit 55c8bc8

Please sign in to comment.