Skip to content

Commit

Permalink
Fixed ticket #132: Avoid using auto_ptr, this time for sure. This sol…
Browse files Browse the repository at this point in the history
…ution requires the detection of the availability of unique_ptr at build time (set HPX_USE_UNIQUE_PTR to 1, if available).

git-svn-id: https://svn.cct.lsu.edu/repos/projects/parallex/trunk/hpx@5529 5079c8e4-9419-0410-93bb-9e5ee278c886
  • Loading branch information
hkaiser committed Sep 21, 2011
1 parent 3485036 commit 5244a53
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions hpx/config.hpp
Expand Up @@ -242,6 +242,12 @@
#define HPX_STACKTRACES 0
#endif

///////////////////////////////////////////////////////////////////////////////
// Enable usage of std::unique_ptr instead of std::auto_ptr
#if !defined(HPX_USE_UNIQUE_PTR)
#define HPX_USE_UNIQUE_PTR 0
#endif

///////////////////////////////////////////////////////////////////////////////
#define HPX_AGAS_BOOTSTRAP_PREFIX 1U
#define HPX_AGAS_PRIMARY_NS_MSB 0x0000000100000001ULL
Expand Down
14 changes: 13 additions & 1 deletion hpx/runtime/threads/policies/thread_deque.hpp
Expand Up @@ -92,7 +92,11 @@ struct thread_deque

// create the new thread
thread_state_enum state = boost::get<1>(*task);
#if HPX_USE_UNIQUE_PTR != 0
std::unique_ptr<threads::thread> thrd(
#else
std::auto_ptr<threads::thread> thrd(
#endif
new (memory_pool_) threads::thread(
boost::get<0>(*task), memory_pool_, state));

Expand Down Expand Up @@ -148,7 +152,11 @@ struct thread_deque

// create the new thread
thread_state_enum state = boost::get<1>(*task);
#if HPX_USE_UNIQUE_PTR != 0
std::unique_ptr<threads::thread> thrd(
#else
std::auto_ptr<threads::thread> thrd(
#endif
new (memory_pool_) threads::thread(
boost::get<0>(*task), memory_pool_, state));

Expand Down Expand Up @@ -276,7 +284,11 @@ struct thread_deque
if (run_now) {
mutex_type::scoped_lock lk(mtx_);

std::auto_ptr<threads::thread> thrd (
#if HPX_USE_UNIQUE_PTR != 0
std::unique_ptr<threads::thread> thrd(
#else
std::auto_ptr<threads::thread> thrd(
#endif
new (memory_pool_) threads::thread(
data, memory_pool_, initial_state));

Expand Down
8 changes: 8 additions & 0 deletions hpx/runtime/threads/policies/thread_queue.hpp
Expand Up @@ -139,7 +139,11 @@ namespace hpx { namespace threads { namespace policies

// create the new thread
thread_state_enum state = boost::get<1>(*task);
#if HPX_USE_UNIQUE_PTR != 0
std::unique_ptr<threads::thread> thrd (
#else
std::auto_ptr<threads::thread> thrd (
#endif
new (memory_pool_) threads::thread(
boost::get<0>(*task), memory_pool_, state));

Expand Down Expand Up @@ -309,7 +313,11 @@ namespace hpx { namespace threads { namespace policies
if (run_now) {
mutex_type::scoped_lock lk(mtx_);

#if HPX_USE_UNIQUE_PTR != 0
std::unique_ptr<threads::thread> thrd (
#else
std::auto_ptr<threads::thread> thrd (
#endif
new (memory_pool_) threads::thread(
data, memory_pool_, initial_state));

Expand Down

0 comments on commit 5244a53

Please sign in to comment.