5 days ago
Going to quibble a bit with the "efficiency" of the thread-safe buffer, in that it effectively leaves each thread with an ever expanding buffer. That's especially problematic in system-provided threads that tend to be returned to the pool for later reuses.
Better, perhaps, to allocate the buffer in a class or actor such that it can be destroyed when the instance is no longer needed.