|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62500 - trunk/boost/thread
From: anthony_at_[hidden]
Date: 2010-06-07 04:25:44
Author: anthonyw
Date: 2010-06-07 04:25:43 EDT (Mon, 07 Jun 2010)
New Revision: 62500
URL: http://svn.boost.org/trac/boost/changeset/62500
Log:
Consistently use count_type rather than unsigned for indexes into
future waiters vector
Text files modified:
trunk/boost/thread/future.hpp | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2010-06-07 04:25:43 EDT (Mon, 07 Jun 2010)
@@ -388,15 +388,18 @@
class future_waiter
{
+ struct registered_waiter;
+ typedef std::vector<registered_waiter>::size_type count_type;
+
struct registered_waiter
{
boost::shared_ptr<detail::future_object_base> future;
detail::future_object_base::waiter_list::iterator wait_iterator;
- unsigned index;
+ count_type index;
registered_waiter(boost::shared_ptr<detail::future_object_base> const& future_,
detail::future_object_base::waiter_list::iterator wait_iterator_,
- unsigned index_):
+ count_type index_):
future(future_),wait_iterator(wait_iterator_),index(index_)
{}
@@ -404,7 +407,6 @@
struct all_futures_lock
{
- typedef std::vector<registered_waiter>::size_type count_type;
count_type count;
boost::scoped_array<boost::unique_lock<boost::mutex> > locks;
@@ -424,7 +426,7 @@
void unlock()
{
- for(unsigned i=0;i<count;++i)
+ for(count_type i=0;i<count;++i)
{
locks[i].unlock();
}
@@ -433,7 +435,7 @@
boost::condition_variable_any cv;
std::vector<registered_waiter> futures;
- unsigned future_count;
+ count_type future_count;
public:
future_waiter():
@@ -450,12 +452,12 @@
++future_count;
}
- unsigned wait()
+ count_type wait()
{
all_futures_lock lk(futures);
for(;;)
{
- for(unsigned i=0;i<futures.size();++i)
+ for(count_type i=0;i<futures.size();++i)
{
if(futures[i].future->done)
{
@@ -468,7 +470,7 @@
~future_waiter()
{
- for(unsigned i=0;i<futures.size();++i)
+ for(count_type i=0;i<futures.size();++i)
{
futures[i].future->remove_external_waiter(futures[i].wait_iterator);
}
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