non-intrusive exception_ptr support for msvc 7.1 and 8.0 (for now) thanks Anthony Williams

[SVN r65159]
This commit is contained in:
Emil Dotchevski
2010-09-01 06:05:11 +00:00
parent 79964f73df
commit 17304c365c
6 changed files with 730 additions and 96 deletions

View File

@ -7,7 +7,7 @@
import testing ;
project : requirements <exception-handling>on ;
project : requirements <exception-handling>on <define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ;
#to_string
@ -36,7 +36,8 @@ run refcount_ptr_test.cpp ;
run current_exception_cast_test.cpp ;
run no_exceptions_test.cpp : : : <exception-handling>off ;
run errinfos_test.cpp ;
run exception_ptr_test.cpp /boost//thread : : : <threading>multi ;
run exception_ptr_test.cpp /boost//thread /boost//exception : : : <threading>multi ;
compile-fail exception_fail.cpp ;
compile-fail throw_exception_fail.cpp ;
compile-fail error_info_const_fail.cpp ;

View File

@ -10,6 +10,7 @@
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/detail/atomic_count.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
@ -66,7 +67,33 @@ join( thread_handle & t )
rethrow_exception(t.err_);
}
struct exc: boost::exception, std::exception { };
boost::detail::atomic_count exc_count(0);
struct
exc:
virtual boost::exception,
virtual std::exception
{
exc()
{
++exc_count;
}
exc( exc const & )
{
++exc_count;
}
~exc()
{
--exc_count;
}
private:
exc & operator=( exc const & );
};
typedef boost::error_info<struct answer_,int> answer;
void
@ -93,6 +120,7 @@ check( boost::shared_ptr<thread_handle> const & t )
int
main()
{
BOOST_TEST(++exc_count==1);
try
{
std::vector< boost::shared_ptr<thread_handle> > threads;
@ -109,4 +137,5 @@ main()
boost::current_exception_diagnostic_information() << std::endl;
return 42;
}
BOOST_TEST(!--exc_count);
}