|
tin
1.5.9
|
tin is the combined C++ API for deterministic real-time systems. It includes bounded runtime primitives, typed state-machine support, portable I/O contracts, and platform adapter contracts.
New contributors should start with developer onboarding before changing architecture, runtime, platform, tooling, or docs. The contributor path includes a framework walkthrough, minimal complete tin app, decision guide, design invariants, and testing map.
Use tin when a project needs:
tsm behavior definitions and runtime policies;tio I/O facade contracts;thal platform and HAL boundary contracts;tin/runtime.h for runtime primitives and the concrete tin::queue, tin::channel, tin::actor_link, and tin::actor_group aliases.tin::tick_duration, tin::tick_count, and tin::ticks(n) for semantic scheduler ticks. Define TSM_TICK_REP to select a wider unsigned representation and TSM_TICK_PERIOD to select a std::ratio tick period.tin::queue<T, StoragePolicy, OverflowPolicy> for explicit FIFO storage.tin::channel<T, Capacity> for bounded local value movement with handle views.tin::actor_group<Actors...> and typed actor ports for composing local runtime components under a caller-owned execution loop.tsm::task, tsm::after_ticks(n), tsm::yield(), and tsm::cooperative_executor for static cooperative workflows documented in coroutines.tin::dispatch_context for target-neutral tick/sequence metadata.tin::event_sink<Sink, Event> and tin::event_source<Source, Event> for adapter-facing concepts.Use the generated namespace reference for exact declarations.
This example moves ADC samples from a driver-shaped ingress point into a bounded runtime channel. The channel's capacity and overflow behavior are part of the type, so queue pressure is visible in code review.
Handles can expose separate send and receive views without transferring channel ownership:
Latest-sample use cases can use a channel policy that overwrites the newest accepted value while preserving a non-consuming reader:
Adapters describe their boundary with concepts:
The concept states only that the sink can accept a local typed event. Ownership, threading, transport, and middleware policy remain outside tin.
Actors are the tin composition unit for systems with several local components that advance under a caller-owned loop. A source actor can publish a typed value, a runtime actor can own behavior, and a sink actor can consume the resulting report.
The ports and link do not allocate, create threads, or register callbacks. If a bounded sink is full, the link keeps one pending sample and retries it later. See actor tutorial and examples/actor_cell for a complete actor example with execution loop and resource accounting.