nativeEntered method

void nativeEntered(
  1. C conversation,
  2. NativeTurn turn
)

Marks the boundary immediately before a spawned isolate enters the C streamed-send call. Platforms that allow concurrent cancellation issue a retained stop here, once native has work to cancel. A serialized policy keeps it retained until nativeReturned.

Implementation

void nativeEntered(C conversation, NativeTurn turn) {
  if (turn.hasEnded || !identical(_running[conversation], turn)) return;
  if (serializeCancelWithNativeStart) return;
  turn.nativeStartPending = false;
  if (turn.cancelRequested && !turn.cancelSent) {
    turn.cancelSent = true;
    _issueCancel(conversation, turn, cancelNative);
  }
  _retryCancelDuringNativeStart(conversation, turn);
}