![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
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() is safe to call from any thread (typically main sim thread).stop() must be called from the main thread exactly once.start() must be called before post().