Vixen
02b45cc4
csharp
public interface ICoroutineOwner

Whatever a coroutine belongs to, and therefore whatever can cancel it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

An interface rather than Behavior outright, so that a system, an editor tool or a test can own coroutines without inventing a behaviour to hang them on. Behavior implements it, and that is the only implementation most code will ever see.

Cancellation is per-owner, not per-coroutine. A launched coroutine and a coroutine it awaits are indistinguishable once they are suspended — the second one's continuation is held by the first one's state machine, not by the scheduler — so a handle cannot cancel "its own" waits without also being able to name every wait beneath them. Rather than offer a Cancel that quietly misses the nested half, the unit of cancellation is the owner, which reaches all of it.

Fields and properties (2)

  • bool IsDestroyed

    Whether the owner is gone. Its coroutines cancel at their next resume point.

  • int CoroutineGeneration

    Bumped by StopCoroutines. An awaitable records the value it was created under and cancels if it no longer matches.

Used by (4)

  • BehaviorVixen.Engine
  • CoroutineAwaitableVixen.Engine
  • CoroutineSchedulerVixen.Engine
  • EntryVixen.Engine