Hacker News new | ask | show | jobs
by layer8 339 days ago
Well, yeah, it depends on what you want to log.

> collect all the buffers

Which requires some sort of synchronization (or lock-free data structures), because of concurrent writes by other threads. In that situation, you can also simply use a dedicated thread to periodically flush the log buffers.

1 comments

Yes, but crucially, only 1/period, not on every single "should log?" call, which is what I was referring to above. The per-thread mutexes are uncontended virtually all the time.