SAService Architect Open designer
SAService ArchitectDocumentation
Framework lifecycle Service::start / stop / waitStopped

C++ Coro lifecycle — Startup and Graceful Shutdown

Awaitable initialization and shutdown on one Coro runtime, with a shared shutdown deadline.

When to use

Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.

Behavior

  • Generated main creates CoroRuntime, then awaits service.start on its executor.
  • Function makers in the same initializer group run concurrently; initializer groups are ordered.
  • The selected epoll or io_uring backend serves the same generated business interfaces.
  • The main thread observes process signals independently from business workers and starts the shutdown deadline once.
  • Shutdown awaits service.stop with that deadline and service.waitStopped before releasing service ownership, flushing telemetry and joining runtime workers.

C++ Coro startup sequence

  • Load configuration and create CoroRuntime.
  • Initialize makers, functions, graph and endpoint bindings.
  • Await service.start before waiting for process signals.

C++ Coro shutdown sequence

  • Start one deadline on signal or startup failure.
  • Stop configuration reload and await service.stop(context.withDeadline(deadline)).
  • Await waitStopped while accepted operations retain their required objects.
  • Release the service, flush telemetry, then stop and join runtime workers.
  • The process watchdog bounds all phases, including destruction; it is not a fresh timeout for each component.

Hooks and boundaries properties

Generated extension points and runtime-owned lifecycle boundaries.

PropertyTypeDescription
MakeNamecoroutine factory

Returns awaitable<unique_ptr<Name>> with context and environment.

startawaitable lifecycle

Activates the generated service.

stop(context)awaitable lifecycle

Stops using the supplied shared deadline.

waitStoppedawaitable lifecycle

Waits for retained shutdown work before normal ownership release.

ArmShutdownDeadlinegenerated process policy

Forces process exit if graceful shutdown exceeds its total budget.

Lifecycle outline

configure -> make once -> bind -> start -> admit -> drain -> stop