26 Sep 2007 redi   » (Master)

GCC shared_ptr updates

I recently made my first libstdc++ commit in two years, as I no longer work for a company that maintains its own non-standard C++ Standard Library and that makes it difficult to do open-source work.

When I get the time I'll finish some optimisations to shared_ptr, removing redundant memory barriers and synchronised atomic operations when they're not needed. This necessitated reading more about relaxed memory-ordering and the latest threads and memory model for C++ proposals. More of it makes sense than it did last time I read them, so either the proposals are clearer or I'm starting to get it ... probably the former.

One of my aims is to allow you to use a non-threadsafe shared_ptr in multi-threaded programs. This is useful when you want the benefits of shared_ptr but you know certain objects are never shared between threads, so fully-fenced atomic operations are unnecessarily expensive. Ideally I'd like to say something like __gnu_cxx::shared_ptr_unlocked<T>, which is less ugly than __gnu_cxx::__shared_ptr<T, __gnu_cxx::_S_single>.

Lazy web, can you suggest a better name than shared_ptr_unlocked?

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!