This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: debug mode performance patch
On 16 November 2010 21:54, Paolo Carlini wrote:
> ... one more small issue:
>
>> ? ?Here is a new proposition with the deadlock issue fixed. I use auto_ptr to acquire it even if it is deprecated because unique_ptr is only available in gnu++0x mode and the library is not built in this mode, is it fine ?
>
> It is suboptimal, in my opinion: auto_ptr has well known very serious design flaws and it would be better to stay away from it. Thus, if, as I hope, the pointer is used only in a *.cc file, the straightforward thing to do would be building the file in c++0x mode, as happens already for many other *.cc files. Hacking the Makefile.am in /src for this is very simple (then, again, 'autoreconf').
Well if you're going to build in C++0x mode then we can use
std::unique_lock with std::defer_lock and avoid using the heap.
__gnu_cxx::__scoped_lock doesn't support deferred locks but
std::unique_lock does.