![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Separate IO writer thread with a bounded task queue (Phase 5, R17). More...
#include "WriteTask.hpp"#include <thread>#include <mutex>#include <condition_variable>#include <queue>#include <atomic>#include <functional>Go to the source code of this file.
Classes | |
| class | openswmm::IOThread |
| Producer-consumer IO thread for writing simulation snapshots. More... | |
Namespaces | |
| namespace | openswmm |
Separate IO writer thread with a bounded task queue (Phase 5, R17).
IOThread decouples simulation computation from output writing. The main simulation thread posts WriteTask objects; the IO thread drains them by calling PluginFactory::update_all() on each snapshot.
The queue capacity is configurable (default: 8 items). If the queue is full, post() blocks the main thread until space is available. This provides back-pressure if the IO thread is slower than the simulation.
post() serializes multiple producers; the WebAssembly path runs synchronously and requires serialized callers.stop() is safe repeatedly; do not race start() with another lifecycle call.start() must be called before post().