status of sp_counted_base_solaris.hpp

Hi all, I'm interested in getting boost::shared_ptr to use atomic ops on Solaris. I notice there is an implementation using the OS-provided atomics in boost/detail/sp_counted_base_solaris.hpp, but it doesn't seem to be included. According to this thread: http://lists.boost.org/Archives/boost/2006/07/107144.php, it seems the reason might be that it wasn't possible to come up with a proper preprocessor condition to include it on the right versions of Solaris. I'm considering modifying my boost installation to include this header on Solaris - does anyone know of any issues with the code, or can they confirm that it has been well tested? Are there any other reasons for its omission? Thanks, Graham -- Graham Bennett

Graham Bennett wrote:
Hi all,
I'm interested in getting boost::shared_ptr to use atomic ops on Solaris. I notice there is an implementation using the OS-provided atomics in boost/detail/sp_counted_base_solaris.hpp, but it doesn't seem to be included. According to this thread:
http://lists.boost.org/Archives/boost/2006/07/107144.php, it seems the reason might be that it wasn't possible to come up with a proper preprocessor condition to include it on the right versions of Solaris.
What implementation does your platform currently pick? There is also sp_counted_base_gcc_sparc.hpp, which does use atomic operations.

On Mon, Jan 10, 2011 at 11:29:06PM +0200, Peter Dimov wrote:
Graham Bennett wrote:
Hi all,
I'm interested in getting boost::shared_ptr to use atomic ops on Solaris. I notice there is an implementation using the OS-provided atomics in boost/detail/sp_counted_base_solaris.hpp, but it doesn't seem to be included. According to this thread:
http://lists.boost.org/Archives/boost/2006/07/107144.php, it seems the reason might be that it wasn't possible to come up with a proper preprocessor condition to include it on the right versions of Solaris.
What implementation does your platform currently pick? There is also sp_counted_base_gcc_sparc.hpp, which does use atomic operations.
Hi Peter, On my platform (Solaris 10 on x86 with Sun Studio 12), it picks sp_counted_base_spin.hpp. Unfortunately there is no actual spinlock implementation picked for this platform either, so it ends up with a plain pthread_mutex_lock/unlock, which is not ideal. I need to stick with Studio for other reasons, so unfortunately gcc is not an option. Thanks for the response, Graham -- Graham Bennett

Graham Bennett wrote:
Hi Peter,
On my platform (Solaris 10 on x86 with Sun Studio 12), it picks sp_counted_base_spin.hpp. Unfortunately there is no actual spinlock implementation picked for this platform either, so it ends up with a plain pthread_mutex_lock/unlock, which is not ideal.
Well, in that case, to get back to your original question - sp_counted_base_solaris.hpp should work, as far as I know; the only reason for not using it is that we've been unable to come up with the proper preprocessor code for including it. There are multithreaded tests in libs/smart_ptr/test - shared_ptr_mt_test, weak_ptr_mt_test - that you can run (in addition to the rest) as a sanity check.

On Tue, Jan 11, 2011 at 12:48:44AM +0200, Peter Dimov wrote:
Graham Bennett wrote:
On my platform (Solaris 10 on x86 with Sun Studio 12), it picks sp_counted_base_spin.hpp. Unfortunately there is no actual spinlock implementation picked for this platform either, so it ends up with a plain pthread_mutex_lock/unlock, which is not ideal.
Well, in that case, to get back to your original question - sp_counted_base_solaris.hpp should work, as far as I know; the only reason for not using it is that we've been unable to come up with the proper preprocessor code for including it. There are multithreaded tests in libs/smart_ptr/test - shared_ptr_mt_test, weak_ptr_mt_test - that you can run (in addition to the rest) as a sanity check.
I've given the unit tests a try, and unfortunately there are a lot of test failures with sp_counted_base_solaris.hpp enabled (shared_ptr_test, smart_ptr_test, weak_ptr_mt_test etc.). I get no failures with the original implementation. I will take a look to see if I can see anything obvious that would be causing the problems. cheers, Graham -- Graham Bennett

Graham Bennett wrote:
I'm interested in getting boost::shared_ptr to use atomic ops on Solaris. I notice there is an implementation using the OS-provided atomics in boost/detail/sp_counted_base_solaris.hpp
About a year ago I got excited by the idea that Helge Bahmann's proposed Boost.Atomic library could become a single place for platform-specific atomic code to live, rather than having it replicated in each place that needs it (e.g. sp_counted_base). I even got as far as writing an sp_counted_base that used Boost.Atomic. I don't know what has stalled Boost.Atomic, but I still think this is a good approach. So rather than modifying sp_counted_base you might consider making Boost.Atomic work on your platform, especially if there are other things in your code that need atomic ops. Regards, Phil.

On Tue, Jan 11, 2011 at 11:00:28AM +0000, Phil Endecott wrote:
Graham Bennett wrote:
I'm interested in getting boost::shared_ptr to use atomic ops on Solaris. I notice there is an implementation using the OS-provided atomics in boost/detail/sp_counted_base_solaris.hpp
About a year ago I got excited by the idea that Helge Bahmann's proposed Boost.Atomic library could become a single place for platform-specific atomic code to live, rather than having it replicated in each place that needs it (e.g. sp_counted_base). I even got as far as writing an sp_counted_base that used Boost.Atomic.
I don't know what has stalled Boost.Atomic, but I still think this is a good approach. So rather than modifying sp_counted_base you might consider making Boost.Atomic work on your platform, especially if there are other things in your code that need atomic ops.
Hi Phil, Thanks, I'll take a look at Boost.Atomic. I do actually have working atomic ops using inline assembler for the platform in my own code that could be imported. Including them is a little bit of a pain from a compilation point of view though, since the inline file needs to be passed to every compilation unit with Sun Studio. cheers, Graham -- Graham Bennett

----- Mail original -----
De: "Graham Bennett" <graham-boost@simulcra.org> À: boost@lists.boost.org Envoyé: Lundi 10 Janvier 2011 21:41:53 Objet: [boost] status of sp_counted_base_solaris.hpp
Hi all,
I'm interested in getting boost::shared_ptr to use atomic ops on Solaris. I notice there is an implementation using the OS-provided atomics in boost/detail/sp_counted_base_solaris.hpp, but it doesn't seem to be included. According to this thread: http://lists.boost.org/Archives/boost/2006/07/107144.php, it seems the reason might be that it wasn't possible to come up with a proper preprocessor condition to include it on the right versions of Solaris.
I'm considering modifying my boost installation to include this header on Solaris - does anyone know of any issues with the code, or can they confirm that it has been well tested? Are there any other reasons for its omission?
I tried on a real mt program and got random crashes with SIGBUS signals. Sorry I have no simple test case at the moment. SunOS 5.10 x86, Sunstudio 12, Boost 1.48. Regards, Ivan
participants (4)
-
Graham Bennett
-
Ivan Le Lann
-
Peter Dimov
-
Phil Endecott