On Monday 29 April 2013 23:07:32 adrien courdavault wrote:
Hi
I'm really interested by the new Log library. I would like to know if there is a part of this API that could be wait free, not the << operator perhaps, but a specific function to log a message without having to worry about a malloc or lock called inside the library. I would like to use this from a time critical thread.
The library is not lock-free, it will have to allocate dynamic memory and
obtain locks when processing log records (but not when you call operator<<
while composing the message).
However, the library is quite friendly to multithreaded applications. It uses
shared locks internally when possible, so different threads can process
records simultaneously. Synchronous sinks will block on contention, although
the library tries to avoid that when multiple sinks are used. You can try
using asynchronous sinks if that's the problem. asynchronous_sink