|
Boost : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-06-18 15:17:28
Cédric Venet wrote:
>> bounces_at_[hidden]] 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk