
Cédric Venet wrote:
bounces@lists.boost.org] De la part de Ion Gaztañaga
-> Hard formatting: printf/scanf are much easier to use and they don't need several hundred of function calls to do their job. The operator<< overloading is also a problem if each call needs some internal locking. A formatting syntax that can minimize the locking needs would be a good choice. I would be really happy with a type-safe printf (variadic templates to the rescue).
You can limit the need of locking call pretty easily, even with operator <<. You just need to use a temporary object which unlock the mutex when destroyed:
Nice info. My point is that the interface makes locking harder and we need to do some (esoteric) tricks. Many times, the locking need is deep in the IO architecture and taking the lock outside to the user code to group several calls in a single lock leads to bigger critical sections -> more contention. IMHO, the design should minimize both locking calls and critical section size. My point is that comparing to printf, concatenating operator << (which means several chained functions instead of a single function call) makes things a bit harder. Anyway, I think your solution is nice and useful. Regards, Ion
participants (1)
-
Ion Gaztañaga