|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52610 - in sandbox/task: boost boost/task boost/task/detail libs/task/src
From: oliver.kowalke_at_[hidden]
Date: 2009-04-26 14:31:12
Author: olli
Date: 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
New Revision: 52610
URL: http://svn.boost.org/trac/boost/changeset/52610
Log:
* cleanup
Removed:
sandbox/task/boost/task/lifo.hpp
Text files modified:
sandbox/task/boost/task.hpp | 3 ++-
sandbox/task/boost/task/async.hpp | 2 --
sandbox/task/boost/task/async_handle.hpp | 4 ++--
sandbox/task/boost/task/detail/interrupter.hpp | 2 +-
sandbox/task/boost/task/detail/pool_callable.hpp | 25 +++++++++++++++----------
sandbox/task/boost/task/detail/worker.hpp | 2 +-
sandbox/task/boost/task/semaphore.hpp | 6 +++---
sandbox/task/libs/task/src/interrupter.cpp | 4 ++--
sandbox/task/libs/task/src/pool_callable.cpp | 4 ++--
sandbox/task/libs/task/src/semaphore_posix.cpp | 22 +++++++++++++++-------
10 files changed, 43 insertions(+), 31 deletions(-)
Modified: sandbox/task/boost/task.hpp
==============================================================================
--- sandbox/task/boost/task.hpp (original)
+++ sandbox/task/boost/task.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -13,13 +13,14 @@
#include <boost/task/default_pool.hpp>
#include <boost/task/exceptions.hpp>
#include <boost/task/fifo.hpp>
+#include <boost/task/future.hpp>
#include <boost/task/id.hpp>
#include <boost/task/info.hpp>
-#include <boost/task/lifo.hpp>
#include <boost/task/pool.hpp>
#include <boost/task/poolsize.hpp>
#include <boost/task/priority.hpp>
#include <boost/task/scanns.hpp>
+#include <boost/task/semaphore.hpp>
#include <boost/task/smart.hpp>
#include <boost/task/task.hpp>
#include <boost/task/unbounded_channel.hpp>
Modified: sandbox/task/boost/task/async.hpp
==============================================================================
--- sandbox/task/boost/task/async.hpp (original)
+++ sandbox/task/boost/task/async.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -58,9 +58,7 @@
{
void operator()( thread * thrd)
{
-printf("thrd->join() - 1\n");
thrd->join();
-printf("thrd->join() - 2\n");
delete thrd;
}
};
Modified: sandbox/task/boost/task/async_handle.hpp
==============================================================================
--- sandbox/task/boost/task/async_handle.hpp (original)
+++ sandbox/task/boost/task/async_handle.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -166,9 +166,9 @@
id id_;
async_handle(
+ id const& id__,
shared_future< void > const& fut,
- detail::interrupter const& intr,
- id const& id__)
+ detail::interrupter const& intr)
:
fut_( fut),
intr_( intr),
Modified: sandbox/task/boost/task/detail/interrupter.hpp
==============================================================================
--- sandbox/task/boost/task/detail/interrupter.hpp (original)
+++ sandbox/task/boost/task/detail/interrupter.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -33,7 +33,7 @@
bool done_;
condition_variable cond_;
mutex mtx_;
- shared_ptr< thread > thrd_;
+ shared_ptr< thread > thrd_;
void interrupt_();
Modified: sandbox/task/boost/task/detail/pool_callable.hpp
==============================================================================
--- sandbox/task/boost/task/detail/pool_callable.hpp (original)
+++ sandbox/task/boost/task/detail/pool_callable.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -21,9 +21,13 @@
{
namespace detail
{
+class scoped_guard;
+
class BOOST_TASK_DECL pool_callable
{
private:
+ friend class scoped_guard;
+
struct impl
{
virtual ~impl() {}
@@ -59,16 +63,6 @@
shared_ptr< impl > impl_;
public:
- class scoped_guard : public noncopyable
- {
- private:
- pool_callable & ca_;
-
- public:
- scoped_guard( pool_callable &, shared_ptr< thread > &);
-
- ~scoped_guard();
- };
pool_callable();
@@ -85,6 +79,17 @@
void clear();
};
+
+class BOOST_TASK_DECL scoped_guard : public noncopyable
+{
+private:
+ pool_callable ca_;
+
+public:
+ scoped_guard( pool_callable &, shared_ptr< thread > &);
+
+ ~scoped_guard();
+};
} } }
#include <boost/config/abi_suffix.hpp>
Modified: sandbox/task/boost/task/detail/worker.hpp
==============================================================================
--- sandbox/task/boost/task/detail/worker.hpp (original)
+++ sandbox/task/boost/task/detail/worker.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -102,7 +102,7 @@
BOOST_ASSERT( ! ca.empty() );
guard grd( get_pool().active_worker_);
{
- pool_callable::scoped_guard lk( ca, thrd_);
+ scoped_guard lk( ca, thrd_);
ca();
}
ca.clear();
Deleted: sandbox/task/boost/task/lifo.hpp
==============================================================================
--- sandbox/task/boost/task/lifo.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,67 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_TASK_LIFO_H
-#define BOOST_TASK_LIFO_H
-
-#include <cstddef>
-#include <list>
-
-#include <boost/task/detail/pool_callable.hpp>
-#include <boost/task/detail/info.hpp>
-
-namespace boost { namespace task
-{
-struct lifo
-{
- typedef detail::has_no_priority priority_tag_type;
-
- class impl
- {
- public:
- typedef detail::pool_callable item;
- typedef std::list< item >::iterator iterator;
- typedef std::list< item >::const_iterator const_iterator;
-
- private:
- std::list< item > lst_;
-
- public:
- void push( item const& itm)
- { lst_.push_front( itm); }
-
- const item pop()
- {
- item itm( lst_.front() );
- lst_.pop_front();
- return itm;
- }
-
- std::size_t size() const
- { return lst_.size(); }
-
- bool empty() const
- { return lst_.empty(); }
-
- void clear()
- { lst_.clear(); }
-
- const iterator begin()
- { return lst_.begin(); }
-
- const const_iterator begin() const
- { return lst_.begin(); }
-
- const iterator end()
- { return lst_.end(); }
-
- const const_iterator end() const
- { return lst_.end(); }
- };
-};
-} }
-
-#endif // BOOST_TASK_LIFO_H
Modified: sandbox/task/boost/task/semaphore.hpp
==============================================================================
--- sandbox/task/boost/task/semaphore.hpp (original)
+++ sandbox/task/boost/task/semaphore.hpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -30,9 +30,9 @@
{
private:
# if defined(BOOST_WINDOWS_API)
- HANDLE async_handle_;
+ HANDLE handle_;
# elif defined(BOOST_POSIX_API)
- sem_t async_handle_;;
+ sem_t handle_;;
# endif
public:
semaphore( int);
@@ -41,8 +41,8 @@
void post();
- bool try_wait();
void wait();
+ bool try_wait();
int value();
};
Modified: sandbox/task/libs/task/src/interrupter.cpp
==============================================================================
--- sandbox/task/libs/task/src/interrupter.cpp (original)
+++ sandbox/task/libs/task/src/interrupter.cpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -45,8 +45,8 @@
interrupter::impl::reset()
{
unique_lock< mutex > lk( mtx_);
- thrd_.reset();
BOOST_ASSERT( thrd_);
+ thrd_.reset();
try
{ this_thread::interruption_point(); }
catch ( thread_interrupted const&)
@@ -98,7 +98,7 @@
void
interrupter::reset()
-{ impl_->reset(); }
+{ impl_->reset(); }
void
interrupter::interrupt()
Modified: sandbox/task/libs/task/src/pool_callable.cpp
==============================================================================
--- sandbox/task/libs/task/src/pool_callable.cpp (original)
+++ sandbox/task/libs/task/src/pool_callable.cpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -26,11 +26,11 @@
pool_callable::clear()
{ impl_.reset(); }
-pool_callable::scoped_guard::scoped_guard( pool_callable & ca, shared_ptr< thread > & thrd)
+scoped_guard::scoped_guard( pool_callable & ca, shared_ptr< thread > & thrd)
: ca_( ca)
{ ca_.impl_->set( thrd); }
-pool_callable::scoped_guard::~scoped_guard()
+scoped_guard::~scoped_guard()
{ ca_.impl_->reset(); }
} } }
Modified: sandbox/task/libs/task/src/semaphore_posix.cpp
==============================================================================
--- sandbox/task/libs/task/src/semaphore_posix.cpp (original)
+++ sandbox/task/libs/task/src/semaphore_posix.cpp 2009-04-26 14:31:10 EDT (Sun, 26 Apr 2009)
@@ -14,33 +14,41 @@
namespace boost { namespace task
{
semaphore::semaphore( int value)
-: async_handle_()
+: handle_()
{
- if ( ::sem_init( & async_handle_, 0, value) == -1)
+ if ( ::sem_init( & handle_, 0, value) == -1)
throw system::system_error( errno, system::system_category);
}
semaphore::~semaphore()
-{ ::sem_destroy( & async_handle_); }
+{ ::sem_destroy( & handle_); }
void
semaphore::post()
{
- if ( ::sem_post( & async_handle_) == -1)
+ if ( ::sem_post( & handle_) == -1)
throw system::system_error( errno, system::system_category);
}
void
semaphore::wait()
{
- if ( ::sem_wait( & async_handle_) == -1)
+ int ret( -1);
+ do
+ { ret = ::sem_wait( & handle_); }
+ while ( ret == -1 && errno == EINTR);
+ if ( ret == -1)
throw system::system_error( errno, system::system_category);
}
bool
semaphore::try_wait()
{
- if ( ::sem_trywait( & async_handle_) == -1)
+ int ret( -1);
+ do
+ { ret = ::sem_trywait( & handle_); }
+ while ( ret == -1 && errno == EINTR);
+ if ( ret == -1)
{
if ( errno == EAGAIN)
return false;
@@ -54,7 +62,7 @@
semaphore::value()
{
int value( 0);
- if ( ::sem_getvalue( & async_handle_, & value) == -1)
+ if ( ::sem_getvalue( & handle_, & value) == -1)
throw system::system_error( errno, system::system_category);
return value;
}
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