|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71996 - in sandbox/block_ptr: boost libs/smart_ptr/example
From: phil_at_[hidden]
Date: 2011-05-16 16:03:52
Author: pbouchard
Date: 2011-05-16 16:03:51 EDT (Mon, 16 May 2011)
New Revision: 71996
URL: http://svn.boost.org/trac/boost/changeset/71996
Log:
* Fixed assignment operator having raw pointers
Text files modified:
sandbox/block_ptr/boost/block_ptr.hpp | 4 ++++
sandbox/block_ptr/libs/smart_ptr/example/thread_test.cpp | 3 ++-
2 files changed, 6 insertions(+), 1 deletions(-)
Modified: sandbox/block_ptr/boost/block_ptr.hpp
==============================================================================
--- sandbox/block_ptr/boost/block_ptr.hpp (original)
+++ sandbox/block_ptr/boost/block_ptr.hpp 2011-05-16 16:03:51 EDT (Mon, 16 May 2011)
@@ -277,6 +277,10 @@
template <typename V>
block_ptr & operator = (block<V> * p)
{
+#ifndef BOOST_DISABLE_THREADS
+ mutex::scoped_lock scoped_lock(block_header::mutex_);
+#endif
+
release(false);
init(p);
Modified: sandbox/block_ptr/libs/smart_ptr/example/thread_test.cpp
==============================================================================
--- sandbox/block_ptr/libs/smart_ptr/example/thread_test.cpp (original)
+++ sandbox/block_ptr/libs/smart_ptr/example/thread_test.cpp 2011-05-16 16:03:51 EDT (Mon, 16 May 2011)
@@ -1,5 +1,6 @@
#include <iostream>
#include <boost/thread.hpp>
+#define BOOST_BP_RAW_POINTER
#include <boost/block_ptr.hpp>
//#include <boost/thread/mutex.hpp>
@@ -17,7 +18,7 @@
for (int i = 0; i < 100000; ++ i)
{
cout << id << "-" << i << ", " << flush;
- p = make_block< pair<int, int> >(make_pair(id, i));
+ p = new block< pair<int, int> >(make_pair(id, i));
}
cout << endl;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk