
I've made some pretty extensive changes to the implementation of shared_ptr. It now uses a lock-free algorithm (originally invented by Alexander Terekhov) on Windows, and the old detail/shared_count.hpp has been refactored into a number of smaller headers. A per-count pthread_mutex is still being used on non-Windows platforms, but this is also going to change soon. Now is the time to test the new implementation; please report any errors you encounter. Some of you have posted patches against the old implementation; these will need to be reexamined, too. detail/lightweight_mutex will also change "soon"; it will just map into a CRITICAL_SECTION or a pthread_mutex depending on the platform. The spin locks will disappear. shared_ptr no longer uses lightweight_mutex. If you use some of the undocumented features of shared_ptr - BOOST_SP_USE_STD_ALLOCATOR, BOOST_SP_ENABLE_DEBUG_HOOKS, sp_collector.cpp - please say so. During the refactoring I may drop some of these features in order to simplify and streamline the implementation. Thanks, -- Peter Dimov http://www.pdimov.com

On Mar 17, 2005, at 8:38 PM, Peter Dimov wrote:
Now is the time to test the new implementation; please report any errors you encounter. Some of you have posted patches against the old implementation; these will need to be reexamined, too.
Some warnings popped up on Mac OS X: /u/dgregor/Projects/boost/boost/detail/sp_counted_base_pt.hpp: In member function `long int boost::detail::sp_counted_base::use_count() const': /u/dgregor/Projects/boost/boost/detail/sp_counted_base_pt.hpp:123: warning: invalid conversion from `const pthread_mutex_t*' to `pthread_mutex_t*' /u/dgregor/Projects/boost/boost/detail/sp_counted_base_pt.hpp:125: warning: invalid conversion from `const pthread_mutex_t*' to `pthread_mutex_t*' Doug

Doug Gregor wrote:
On Mar 17, 2005, at 8:38 PM, Peter Dimov wrote:
Now is the time to test the new implementation; please report any errors you encounter. Some of you have posted patches against the old implementation; these will need to be reexamined, too.
Some warnings popped up on Mac OS X:
/u/dgregor/Projects/boost/boost/detail/sp_counted_base_pt.hpp: In member function `long int boost::detail::sp_counted_base::use_count() const': /u/dgregor/Projects/boost/boost/detail/sp_counted_base_pt.hpp:123: warning: invalid conversion from `const pthread_mutex_t*' to `pthread_mutex_t*' /u/dgregor/Projects/boost/boost/detail/sp_counted_base_pt.hpp:125: warning: invalid conversion from `const pthread_mutex_t*' to `pthread_mutex_t*'
Ah yes, I forgot to make the mutex mutable. Thanks Doug.

"Peter Dimov" <pdimov@mmltd.net> wrote in message news:005501c52b5b$2cfccaf0$6501a8c0@pdimov2...
I've made some pretty extensive changes to the implementation of shared_ptr. It now uses a lock-free algorithm (originally invented by Alexander Terekhov) on Windows, and the old detail/shared_count.hpp has been refactored into a number of smaller headers. A per-count pthread_mutex is still being used on non-Windows platforms, but this is also going to change soon.
Now is the time to test the new implementation; please report any errors you encounter. Some of you have posted patches against the old implementation; these will need to be reexamined, too.
detail/lightweight_mutex will also change "soon"; it will just map into a CRITICAL_SECTION or a pthread_mutex depending on the platform. The spin locks will disappear. shared_ptr no longer uses lightweight_mutex.
If you use some of the undocumented features of shared_ptr - BOOST_SP_USE_STD_ALLOCATOR, BOOST_SP_ENABLE_DEBUG_HOOKS, sp_collector.cpp - please say so. During the refactoring I may drop some of these features in order to simplify and streamline the implementation.
Thanks,
-- Peter Dimov http://www.pdimov.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Jonathan Turkanis wrote:
"Peter Dimov" wrote:
I've made some pretty extensive changes to the implementation of shared_ptr. It now uses a lock-free algorithm (originally invented by Alexander Terekhov) on Windows, and the old detail/shared_count.hpp has been refactored into a number of smaller headers. A per-count pthread_mutex is still being used on non-Windows platforms, but this is also going to change soon.
Apparently I sent this by accident. Sorry. Jonathan
participants (3)
-
Doug Gregor
-
Jonathan Turkanis
-
Peter Dimov