ThreadSafeSink

Ready-to-run robot software for hobby robotics.

In the namespace construct::mesh. Declared in src/libs/libconstruct/construct/mesh/ThreadSafeSink.hpp.

Detailed description

Mutex-batched fan-in: many producer threads consume() into this sink concurrently; it forwards to a single downstream sink in whole batches of at least batchSize triangles, so the downstream (a file writer, a filter) sees serialized, coarse-grained calls instead of per-thread fine-grained ones. finish() drains the partial batch and forwards the downstream finish() exactly once — extra finish() calls are tolerated and ignored, because N producers joining cannot cheaply elect one finisher.

Ordering: batches from different threads interleave in lock-acquisition order. Triangle soup has no meaningful order (the downstream welds and filters by content), so this is a documented property, not a defect.

In this section