Boost logo

Boost-Commit :

From: igaztanaga_at_[hidden]
Date: 2007-12-01 13:01:17


Author: igaztanaga
Date: 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
New Revision: 41540
URL: http://svn.boost.org/trac/boost/changeset/41540

Log:
Simplified mutexes for systems with no _POSIX_TIMEOUTS.
Removed:
   trunk/libs/interprocess/proj/to-do.txt
   trunk/libs/intrusive/proj/vc7ide/to-do.txt
   trunk/libs/intrusive/test/test_templates.hpp
Text files modified:
   trunk/boost/interprocess/detail/workaround.hpp | 8 +
   trunk/boost/interprocess/sync/emulation/interprocess_mutex.hpp | 4
   trunk/boost/interprocess/sync/interprocess_mutex.hpp | 8 -
   trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp | 12 --
   trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp | 146 ++++++---------------------------
   trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp | 173 ++++++---------------------------------
   trunk/libs/interprocess/doc/html/reference.css | 8 +
   trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj | 4
   trunk/libs/interprocess/test/condition_test_template.hpp | 6
   trunk/libs/interprocess/test/expand_bwd_test_template.hpp | 4
   trunk/libs/interprocess/test/mutex_test_template.hpp | 28 +++---
   trunk/libs/interprocess/test/named_creation_template.hpp | 9 -
   trunk/libs/interprocess/test/semaphore_test_template.hpp | 4
   trunk/libs/interprocess/test/shared_memory_mapping_test.cpp | 2
   trunk/libs/intrusive/doc/html/reference.css | 8 +
   trunk/libs/intrusive/example/doc_splay_algorithms.cpp | 3
   16 files changed, 110 insertions(+), 317 deletions(-)

Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -15,6 +15,8 @@
 
 #if !(defined BOOST_WINDOWS) || (defined BOOST_DISABLE_WIN32)
 
+ #include <unistd.h>
+
    #if defined(_POSIX_THREAD_PROCESS_SHARED)
    # if !((_XOPEN_VERSION >= 600) && (_POSIX_THREAD_PROCESS_SHARED - 0 <= 0))
    # if !defined(__CYGWIN__)
@@ -88,6 +90,10 @@
       #endif
    #endif
 
+ #if ((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500)
+ #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
+ #endif
+
 #endif
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
@@ -102,7 +108,7 @@
 # endif
 #endif
 
-#if defined(BOOST_INTERPROCESS_RVALUE_REFERENCE) || defined(BOOST_INTERPROCESS_VARIADIC_TEMPLATES)
+#if defined(BOOST_INTERPROCESS_RVALUE_REFERENCE) && defined(BOOST_INTERPROCESS_VARIADIC_TEMPLATES)
 #define BOOST_INTERPROCESS_PERFECT_FORWARDING
 #endif
 

Modified: trunk/boost/interprocess/sync/emulation/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/emulation/interprocess_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/emulation/interprocess_mutex.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -54,9 +54,7 @@
    if(now >= abs_time) return false;
 
    do{
- boost::uint32_t prev_s = detail::atomic_cas32((boost::uint32_t*)&m_s, 1, 0);
-
- if (m_s == 1 && prev_s == 0){
+ if(this->try_lock()){
          break;
       }
       now = microsec_clock::universal_time();

Modified: trunk/boost/interprocess/sync/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_mutex.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -109,13 +109,7 @@
    #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
       volatile boost::uint32_t m_s;
    #elif defined(BOOST_INTERPROCESS_USE_POSIX)
- #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
- pthread_mutex_t m_mut;
- #else
- pthread_mutex_t m_mut;
- pthread_cond_t m_cond;
- bool m_locked;
- #endif
+ pthread_mutex_t m_mut;
    #endif //#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
    /// @endcond
 };

Modified: trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_recursive_mutex.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -36,7 +36,7 @@
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <cassert>
 
-#if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
+#if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED && defined BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
    #include <pthread.h>
    #include <errno.h>
    #include <boost/interprocess/sync/posix/pthread_helpers.hpp>
@@ -107,15 +107,7 @@
    unsigned int m_nLockCount;
    detail::OS_thread_id_t m_nOwner;
    #else //#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
- #if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 500) && defined BOOST_INTERPROCESS_POSIX_TIMEOUTS
- pthread_mutex_t m_mut;
- #else //#if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 500) && defined BOOST_INTERPROCESS_POSIX_TIMEOUTS
- pthread_mutex_t m_mut;
- pthread_cond_t m_unlocked;
- pthread_t m_thread_id;
- bool m_valid_id;
- unsigned int m_count;
- #endif //#if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 500) && defined BOOST_INTERPROCESS_POSIX_TIMEOUTS
+ pthread_mutex_t m_mut;
    #endif //#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
    /// @endcond
 };

Modified: trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_mutex.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -27,13 +27,13 @@
 #include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <boost/interprocess/exceptions.hpp>
+#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+# include <boost/interprocess/detail/os_thread_functions.hpp>
+#endif
 
 namespace boost {
-
 namespace interprocess {
 
-#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
 inline interprocess_mutex::interprocess_mutex()
 {
    detail::mutexattr_wrapper mut_attr;
@@ -56,139 +56,51 @@
 inline bool interprocess_mutex::try_lock()
 {
    int res = pthread_mutex_trylock(&m_mut);
- if (res == EDEADLK) throw lock_exception();
- assert(res == 0 || res == EBUSY);
+ if (!(res == 0 || res == EBUSY))
+ throw lock_exception();
    return res == 0;
 }
 
 inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
 {
+ #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+
    timespec ts = detail::ptime_to_timespec(abs_time);
    int res = pthread_mutex_timedlock(&m_mut, &ts);
- if (res == EDEADLK || (res != 0 && res != ETIMEDOUT))
+ if (res != 0 && res != ETIMEDOUT)
       throw lock_exception();
    return res == 0;
-}
 
-inline void interprocess_mutex::unlock()
-{
- int res = 0;
- res = pthread_mutex_unlock(&m_mut);
-// if (res == EPERM) throw lock_exception();
- assert(res == 0);
-}
+ #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS
 
-#else //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
 
-inline interprocess_mutex::interprocess_mutex()
- : m_locked(false)
-{
- //Mutex init
- detail::mutexattr_wrapper mut_attr;
- detail::mutex_initializer mut(m_mut, mut_attr);
-
- //Condition init
- detail::condattr_wrapper cond_attr;
- detail::condition_initializer cond(m_cond, cond_attr);
-
- mut.release();
- cond.release();
-}
+ if(now >= abs_time) return false;
 
-inline interprocess_mutex::~interprocess_mutex()
-{
- assert(!m_locked);
- int res = 0;
- res = pthread_mutex_destroy(&m_mut);
- assert(res == 0);
+ do{
+ if(this->try_lock()){
+ break;
+ }
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ return false;
+ }
+ // relinquish current time slice
+ detail::thread_yield();
+ }while (true);
+ return true;
 
- res = pthread_cond_destroy(&m_cond);
- assert(res == 0);
-}
-
-inline void interprocess_mutex::lock()
-{
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- while (m_locked){
- res = pthread_cond_wait(&m_cond, &m_mut);
- assert(res == 0);
- }
-
- assert(!m_locked);
- m_locked = true;
-
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
-}
-
-inline bool interprocess_mutex::try_lock()
-{
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- bool ret = false;
- if (!m_locked)
- {
- m_locked = true;
- ret = true;
- }
-
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
- return ret;
-}
-
-inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
-{
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- timespec ts = detail::ptime_to_timespec(abs_time);
-
- while (m_locked)
- {
- res = pthread_cond_timedwait(&m_cond, &m_mut, &ts);
- assert(res == 0 || res == ETIMEDOUT);
-
- if (res == ETIMEDOUT)
- break;
- }
-
- bool ret = false;
- if (!m_locked)
- {
- m_locked = true;
- ret = true;
- }
-
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
- return ret;
+ #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS
 }
 
 inline void interprocess_mutex::unlock()
 {
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- assert(m_locked);
- m_locked = false;
-
- res = pthread_cond_signal(&m_cond);
- assert(res == 0);
-
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
+ int res = 0;
+ res = pthread_mutex_unlock(&m_mut);
+ assert(res == 0);
 }
 
-#endif //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
 } //namespace interprocess {
-
 } //namespace boost {

Modified: trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -27,12 +27,14 @@
 #include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <boost/interprocess/exceptions.hpp>
+#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+# include <boost/interprocess/detail/os_thread_functions.hpp>
+#endif
 
 namespace boost {
 
 namespace interprocess {
 
-#if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 500) && defined BOOST_INTERPROCESS_POSIX_TIMEOUTS
 inline interprocess_recursive_mutex::interprocess_recursive_mutex()
 {
    detail::mutexattr_wrapper mut_attr(true);
@@ -48,179 +50,58 @@
 
 inline void interprocess_recursive_mutex::lock()
 {
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- if (res == EDEADLK) throw lock_exception();
- assert(res == 0);
+ if (pthread_mutex_lock(&m_mut) != 0)
+ throw lock_exception();
 }
 
 inline bool interprocess_recursive_mutex::try_lock()
 {
- int res = 0;
- res = pthread_mutex_trylock(&m_mut);
- if (res == EDEADLK) throw lock_exception();
- assert(res == 0 || res == EBUSY);
+ int res = pthread_mutex_trylock(&m_mut);
+ if (!(res == 0 || res == EBUSY))
+ throw lock_exception();
    return res == 0;
 }
 
 inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
 {
+ #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
+
    timespec ts = detail::ptime_to_timespec(abs_time);
    int res = pthread_mutex_timedlock(&m_mut, &ts);
- if (res == EDEADLK) throw lock_exception();
- assert(res == 0 || res == EBUSY);
+ if (res != 0 && res != ETIMEDOUT)
+ throw lock_exception();
    return res == 0;
-}
-
-inline void interprocess_recursive_mutex::unlock()
-{
- int res = 0;
- res = pthread_mutex_unlock(&m_mut);
- if (res == EPERM) throw lock_exception();
- assert(res == 0);
-}
-
-#else //#if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 500) && defined BOOST_INTERPROCESS_POSIX_TIMEOUTS
 
-inline interprocess_recursive_mutex::interprocess_recursive_mutex()
- : m_valid_id(false), m_count(0)
-{
- //Mutex init
- detail::mutexattr_wrapper mut_attr;
- detail::mutex_initializer mut(m_mut, mut_attr);
-
- //Condition init
- detail::condattr_wrapper cond_attr;
- detail::condition_initializer cond(m_unlocked, cond_attr);
+ #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS
 
- mut.release();
- cond.release();
-}
-
-inline interprocess_recursive_mutex::~interprocess_recursive_mutex()
-{
- int res = 0;
- res = pthread_mutex_destroy(&m_mut);
- assert(res == 0);
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
 
- res = pthread_cond_destroy(&m_unlocked);
- assert(res == 0);
-}
+ if(now >= abs_time) return false;
 
-inline void interprocess_recursive_mutex::lock()
-{
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- if(res != 0){
- throw interprocess_exception(system_error_code());
- }
- assert(res == 0);
-
- pthread_t tid = pthread_self();
- if (m_valid_id && pthread_equal(m_thread_id, tid)){
- ++m_count;
- }
- else{
- while (m_valid_id)
- {
- res = pthread_cond_wait(&m_unlocked, &m_mut);
- assert(res == 0);
+ do{
+ if(this->try_lock()){
+ break;
       }
+ now = microsec_clock::universal_time();
 
- m_thread_id = tid;
- m_valid_id = true;
- m_count = 1;
- }
-
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
-}
-
-inline bool interprocess_recursive_mutex::try_lock()
-{
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- bool ret = false;
- pthread_t tid = pthread_self();
- if (m_valid_id && pthread_equal(m_thread_id, tid)){
- ++m_count;
- ret = true;
- }
- else if (!m_valid_id){
- m_thread_id = tid;
- m_valid_id = true;
- m_count = 1;
- ret = true;
- }
-
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
- return ret;
-}
-
-inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
-{
- int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- bool ret = false;
- pthread_t tid = pthread_self();
- if (m_valid_id && pthread_equal(m_thread_id, tid)){
- ++m_count;
- ret = true;
- }
- else{
- timespec ts = detail::ptime_to_timespec(abs_time);
-
- while (m_valid_id){
- res = pthread_cond_timedwait(&m_unlocked, &m_mut, &ts);
- if (res == ETIMEDOUT)
- break;
- assert(res == 0);
- }
-
- if (!m_valid_id){
- m_thread_id = tid;
- m_valid_id = true;
- m_count = 1;
- ret = true;
+ if(now >= abs_time){
+ return false;
       }
- }
+ // relinquish current time slice
+ detail::thread_yield();
+ }while (true);
+ return true;
 
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
- return ret;
+ #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS
 }
 
 inline void interprocess_recursive_mutex::unlock()
 {
    int res = 0;
- res = pthread_mutex_lock(&m_mut);
- assert(res == 0);
-
- pthread_t tid = pthread_self();
- if (m_valid_id && !pthread_equal(m_thread_id, tid)){
- res = pthread_mutex_unlock(&m_mut);
- assert(res == 0);
- throw lock_exception();
- }
-
- if (--m_count == 0){
- assert(m_valid_id);
- m_valid_id = false;
-
- res = pthread_cond_signal(&m_unlocked);
- assert(res == 0);
- }
-
    res = pthread_mutex_unlock(&m_mut);
    assert(res == 0);
 }
 
-#endif //#if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 500) && defined BOOST_INTERPROCESS_POSIX_TIMEOUTS
-
 } //namespace interprocess {
 } //namespace boost {

Modified: trunk/libs/interprocess/doc/html/reference.css
==============================================================================
--- trunk/libs/interprocess/doc/html/reference.css (original)
+++ trunk/libs/interprocess/doc/html/reference.css 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -1,3 +1,11 @@
+/*=============================================================================
+ Copyright (c) 2004 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to 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)
+=============================================================================*/
 PRE.synopsis {
   background-color: #e0ffff;
   border: thin solid blue;

Deleted: trunk/libs/interprocess/proj/to-do.txt
==============================================================================
--- trunk/libs/interprocess/proj/to-do.txt 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
+++ (empty file)
@@ -1,73 +0,0 @@
--> Implement zero_memory flag for allocation_command
-
--> Add explanations about system libraries (-lrt) or options (-pthread) to be added
- to the command line.
-
--> The general allocation funtion can be improved with some fixed size allocation bins.
-
--> Update the documentation about memory algorithms with explanations about new functions.
-
--> Adapt error reporting to TR1 system exceptions
-
--> Improve exception messages
-
--> Movability of containers should depend on the no-throw guarantee of allocators copy constructor
-
--> Check self-assignment for vectors
-
--> Detect POD data in vector/deque to use memcpy and minimize code.
-
--> Update writing a new memory allocator explaining new functions (like alignment)
-
--> private node allocators could take the number of nodes as a runtime parameter.
-
--> Explain how to build intrusive indexes.
-
--> Add intrusive index types as available indexes.
-
--> Add maximum alignment allocation limit in PageSize bytes. Otherwise, we can't
- guarantee alignment for process-shared allocations.
-
--> Add default algorithm and index types. The user does not need to know how are
- they implemented.
-
--> Add private mapping to managed classes.
-
--> Add unique_ptr documentation.
-
--> Pass max size check in allocation to node pools
-
--> Add atomic_func explanation in docs
-
--> Once shrink to fit indexes is implemented test all memory has been deallocated
- in tests to detect leaks/implementation failures.
-
--> Improve allocate_many functions to allocate all the nodes forming a singly
- linked list of nodes.
-
--> rbtree_algorithms can be improved wrt the balanced tree. When erasing the old
- node and inserting the new (expanded or shrunk) check if the position should
- be the same. If so, avoid erase() + insert() and just update the size.
-
--> Use in-place expansion capabilities to shrink_to_fit and reserve functions
- from iunordered_index.
-
--> Refactor pool allocators to extract common operations
-
--> Shrink in place interface is not adequate for with objects that don't have
- a trivial destructor: how many destructors can we call before deallocating
- the memory? Options:
- 1. Call destructors in the low-level shrink function (but this might lead to
- deadlock)
- 2. Offer a function to know how much can we shrink (but destructor + shrinking
- would not be atomic so we must guarantee that shrinking will succeed).
-
--> Optimize copy_n with std::copy in vector. Revise other functions to improve optimizations
-
--> Keep an eye on container iterator constness issue to bring Interprocess containers up-to-date.
-
--> change unique_ptr to avoid using compressed_pair
-
--> Improve unique_ptr test to test move assignment and other goodies like assigment from null
-
--> barrier_test fails on MacOS X on PowerPC.
\ No newline at end of file

Modified: trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -238,10 +238,6 @@
                                 RelativePath="..\..\..\..\boost\interprocess\sync\upgradable_lock.hpp">
                         </File>
                         <Filter
- Name="win32"
- Filter="">
- </Filter>
- <Filter
                                 Name="posix"
                                 Filter="">
                                 <File

Modified: trunk/libs/interprocess/test/condition_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/condition_test_template.hpp (original)
+++ trunk/libs/interprocess/test/condition_test_template.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -139,7 +139,7 @@
 
     // Test timed_wait.
     while (data->notified != 3)
- data->condition.timed_wait(lock, ptime_delay(10));
+ data->condition.timed_wait(lock, ptime_delay(5));
     assert(lock ? true : false);
     assert(data->notified == 3);
     data->awoken++;
@@ -147,7 +147,7 @@
 
     // Test predicate timed_wait.
     cond_predicate pred(data->notified, 4);
- bool ret = data->condition.timed_wait(lock, ptime_delay(10), pred);
+ bool ret = data->condition.timed_wait(lock, ptime_delay(5), pred);
     assert(ret);(void)ret;
     assert(lock ? true : false);
     assert(pred());
@@ -177,7 +177,7 @@
 template <class Condition, class Mutex>
 void do_test_condition_notify_all()
 {
- const int NUMTHREADS = 5;
+ const int NUMTHREADS = 3;
    boost::thread_group threads;
    condition_test_data<Condition, Mutex> data;
 

Modified: trunk/libs/interprocess/test/expand_bwd_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/expand_bwd_test_template.hpp (original)
+++ trunk/libs/interprocess/test/expand_bwd_test_template.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -76,7 +76,7 @@
 
 //Function to check if both sets are equal
 template <class Vector1, class Vector2>
-static bool CheckEqualVector(const Vector1 &vector1, const Vector2 &vector2)
+bool CheckEqualVector(const Vector1 &vector1, const Vector2 &vector2)
 {
    if(vector1.size() != vector2.size())
       return false;
@@ -84,7 +84,7 @@
 }
 
 template<class Vector>
-static bool CheckUninitializedIsZero(const Vector & v)
+bool CheckUninitializedIsZero(const Vector & v)
 {
    typedef typename Vector::value_type value_type;
    typename Vector::size_type sz = v.size();

Modified: trunk/libs/interprocess/test/mutex_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/mutex_test_template.hpp (original)
+++ trunk/libs/interprocess/test/mutex_test_template.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -123,7 +123,7 @@
       BOOST_INTERPROCES_CHECK(lock ? true : false);
       lock.unlock();
       BOOST_INTERPROCES_CHECK(!lock);
- boost::posix_time::ptime pt = delay(10*BaseSeconds, 0);
+ boost::posix_time::ptime pt = delay(3*BaseSeconds, 0);
       BOOST_INTERPROCES_CHECK(lock.timed_lock(pt));
       BOOST_INTERPROCES_CHECK(lock ? true : false);
    }
@@ -152,7 +152,7 @@
       }
       {
          //This should always lock
- boost::posix_time::ptime pt = delay(3*BaseSeconds);
+ boost::posix_time::ptime pt = delay(2*BaseSeconds);
          lock_type lock1(mx, pt);
          lock_type lock2(mx, pt);
       }
@@ -171,7 +171,7 @@
       boost::thread::sleep(xsecs(pdata->m_secs));
    }
    else{
- boost::thread::sleep(xsecs(3*BaseSeconds));
+ boost::thread::sleep(xsecs(2*BaseSeconds));
    }
 
    ++shared_val;
@@ -184,7 +184,7 @@
    data<M> *pdata = (data<M> *) arg;
    boost::interprocess::scoped_lock<M> l(sm, boost::interprocess::defer_lock);
    if (l.try_lock()){
- boost::thread::sleep(xsecs(3*BaseSeconds));
+ boost::thread::sleep(xsecs(2*BaseSeconds));
       ++shared_val;
       pdata->m_value = shared_val;
    }
@@ -198,7 +198,7 @@
    boost::interprocess::scoped_lock<M>
       l (sm, boost::interprocess::defer_lock);
    if (l.timed_lock(pt)){
- boost::thread::sleep(xsecs(3*BaseSeconds));
+ boost::thread::sleep(xsecs(2*BaseSeconds));
       ++shared_val;
       pdata->m_value = shared_val;
    }
@@ -223,13 +223,13 @@
    data<M> d1(1);
    data<M> d2(2);
 
- // Locker one launches, holds the lock for 3*BaseSeconds seconds.
+ // Locker one launches, holds the lock for 2*BaseSeconds seconds.
    boost::thread tm1(thread_adapter<M>(&lock_and_sleep, &d1, *pm1));
 
    //Wait 1*BaseSeconds
    boost::thread::sleep(xsecs(1*BaseSeconds));
 
- // Locker two launches, but it won't hold the lock for 3*BaseSeconds seconds.
+ // Locker two launches, but it won't hold the lock for 2*BaseSeconds seconds.
    boost::thread tm2(thread_adapter<M>(&lock_and_sleep, &d2, *pm2));
 
    //Wait completion
@@ -259,7 +259,7 @@
    data<M> d1(1);
    data<M> d2(2);
 
- // Locker one launches, holds the lock for 3*BaseSeconds seconds.
+ // Locker one launches, holds the lock for 2*BaseSeconds seconds.
    boost::thread tm1(thread_adapter<M>(&try_lock_and_sleep, &d1, *pm1));
 
    //Wait 1*BaseSeconds
@@ -293,16 +293,16 @@
       pm2 = &m2;
    }
 
- data<M> d1(1, 3*BaseSeconds);
- data<M> d2(2, 3*BaseSeconds);
+ data<M> d1(1, 2*BaseSeconds);
+ data<M> d2(2, 2*BaseSeconds);
 
- // Locker one launches, holds the lock for 3*BaseSeconds seconds.
+ // Locker one launches, holds the lock for 2*BaseSeconds seconds.
    boost::thread tm1(thread_adapter<M>(&timed_lock_and_sleep, &d1, *pm1));
 
    //Wait 1*BaseSeconds
    boost::thread::sleep(xsecs(1*BaseSeconds));
 
- // Locker two launches, holds the lock for 3*BaseSeconds seconds.
+ // Locker two launches, holds the lock for 2*BaseSeconds seconds.
    boost::thread tm2(thread_adapter<M>(&timed_lock_and_sleep, &d2, *pm2));
 
    //Wait completion
@@ -315,7 +315,7 @@
 }
 
 template <typename M>
-static inline void test_all_lock()
+inline void test_all_lock()
 {
    //Now generic interprocess_mutex tests
    std::cout << "test_lock<" << typeid(M).name() << ">" << std::endl;
@@ -327,7 +327,7 @@
 }
 
 template <typename M>
-static inline void test_all_recursive_lock()
+inline void test_all_recursive_lock()
 {
    //Now generic interprocess_mutex tests
    std::cout << "test_recursive_lock<" << typeid(M).name() << ">" << std::endl;

Modified: trunk/libs/interprocess/test/named_creation_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/named_creation_template.hpp (original)
+++ trunk/libs/interprocess/test/named_creation_template.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -15,13 +15,12 @@
 #include <boost/interprocess/exceptions.hpp>
 #include "boost_interprocess_check.hpp"
 #include <iostream>
-#include <typeinfo>
 #include <boost/interprocess/creation_tags.hpp>
 
 namespace boost { namespace interprocess { namespace test {
 
 template <class NamedResource>
-static inline void create_then_open_then_open_or_create()
+inline void create_then_open_then_open_or_create()
 {
    try{
       //Create it and open it twice
@@ -36,7 +35,7 @@
 }
 
 template <class NamedResource>
-static inline void open_or_create_then_create()
+inline void open_or_create_then_create()
 {
    //Create it with open_or_create and try to create it twice
    NamedResource nresource1(open_or_create);
@@ -49,7 +48,7 @@
 }
 
 template <class NamedResource>
-static inline void dont_create_and_open()
+inline void dont_create_and_open()
 {
    //Try to open it without creating
    try{
@@ -64,7 +63,7 @@
 }
 
 template <class NamedResource>
-static inline void test_named_creation()
+inline void test_named_creation()
 {
    std::cout << "create_then_open_then_open_or_create<"
                << typeid(NamedResource).name() << ">" << std::endl;

Modified: trunk/libs/interprocess/test/semaphore_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/semaphore_test_template.hpp (original)
+++ trunk/libs/interprocess/test/semaphore_test_template.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -282,7 +282,7 @@
 }
 
 template <typename P>
-static inline void test_all_lock()
+inline void test_all_lock()
 {
    //Now generic interprocess_mutex tests
    std::cout << "test_wait<" << typeid(P).name() << ">" << std::endl;
@@ -294,7 +294,7 @@
 }
 
 template <typename P>
-static inline void test_all_recursive_lock()
+inline void test_all_recursive_lock()
 {
    //Now generic interprocess_mutex tests
    std::cout << "test_recursive_lock<" << typeid(P).name() << ">" << std::endl;

Modified: trunk/libs/interprocess/test/shared_memory_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/shared_memory_mapping_test.cpp (original)
+++ trunk/libs/interprocess/test/shared_memory_mapping_test.cpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -69,7 +69,7 @@
          //Create a file mapping
          shared_memory_object mapping(open_only, test::get_process_id_name(), read_write);
          mapped_region region(mapping, read_write, 0, FileSize/2, 0);
- mapped_region region2(mapping, read_write, FileSize/2, 0/*FileSize - FileSize/2*/, 0);
+ mapped_region region2(mapping, read_write, FileSize/2, FileSize - FileSize/2, 0);
 
          unsigned char *checker = (unsigned char*)region.get_address();
          //Check pattern

Modified: trunk/libs/intrusive/doc/html/reference.css
==============================================================================
--- trunk/libs/intrusive/doc/html/reference.css (original)
+++ trunk/libs/intrusive/doc/html/reference.css 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -1,3 +1,11 @@
+/*=============================================================================
+ Copyright (c) 2004 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to 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)
+=============================================================================*/
 PRE.synopsis {
   background-color: #e0ffff;
   border: thin solid blue;

Modified: trunk/libs/intrusive/example/doc_splay_algorithms.cpp
==============================================================================
--- trunk/libs/intrusive/example/doc_splay_algorithms.cpp (original)
+++ trunk/libs/intrusive/example/doc_splay_algorithms.cpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
@@ -75,5 +75,4 @@
    algo::erase(&header, &three);
    return 0;
 }
-
-//]
\ No newline at end of file
+//]

Deleted: trunk/libs/intrusive/proj/vc7ide/to-do.txt
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/to-do.txt 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
+++ (empty file)
@@ -1,7 +0,0 @@
-add includes needed for the snippets
-add section explaining splice(...,n)
-Faltaría, en mi opinión, una guía de qué headers incluyen a cuáles. P.ej.,
-los *_hook.hpp típicamente están incluidos por el header del contenedor asociado, etc.
-Add resize() to list
-Optimize rehash for when shrinking: there is no need to hash the values.
-Optimize store_hash<true> to work with the same node and type traits as store_hash<false>

Deleted: trunk/libs/intrusive/test/test_templates.hpp
==============================================================================
--- trunk/libs/intrusive/test/test_templates.hpp 2007-12-01 13:01:15 EST (Sat, 01 Dec 2007)
+++ (empty file)
@@ -1,65 +0,0 @@
-#ifndef BOOST_INTRUSIVE_TEST_TEST_TEMPLATES_HPP
-#define BOOST_INTRUSIVE_TEST_TEST_TEMPLATES_HPP
-
-#include <vector>
-
-namespace boost {
-namespace intrusive {
-namespace test {
-
-template<class Container>
-void test_shift()
-{
- typedef typename ValueTraits::value_type testvalue_t;
- boost::test_tools::output_test_stream test_seq;
- Container test_cont;
- const int NumElem = 6;
-
- std::vector<typename Container::value_type> values(NumElem);
- for(int i = 0; i < NumElem; ++i){
- values[i] = i+1;
- }
-
- const int num_values = (int)values.size();
- std::vector<int> expected_values(num_values);
-
- //Shift forward all possible positions 3 times
- for(int i = 0; i < num_values*3; ++i){
- test_cont.assign(values.begin(), values.end());
- test_cont.shift_forward(i);
- for(int j = 0; j < num_values; ++j){
- expected_values[(j + num_values - i%num_values) % num_values] = (j + 1);
- }
- std::copy (test_cont.begin(), test_cont.end(),
- std::ostream_iterator<testvalue_t> (test_seq));
- std::stringstream stream;
- std::copy (expected_values.begin(), expected_values.end(),
- std::ostream_iterator<testvalue_t> (stream));
- stream << std::ends;
- BOOST_CHECK (test_seq.is_equal (stream.str().c_str()));
- test_cont.clear();
- }
-
- //Shift backwards all possible positions
- for(int i = 0; i < num_values*2; ++i){
- test_cont.assign(values.begin(), values.end());
- test_cont.shift_backwards(i);
- for(int j = 0; j < num_values; ++j){
- expected_values[(j + i) % num_values] = (j + 1);
- }
- std::copy (test_cont.begin(), test_cont.end(),
- std::ostream_iterator<testvalue_t> (test_seq));
- std::stringstream stream;
- std::copy (expected_values.begin(), expected_values.end(),
- std::ostream_iterator<testvalue_t> (stream));
- stream << std::ends;
- BOOST_CHECK (test_seq.is_equal (stream.str().c_str()));
- test_cont.clear();
- }
-}
-
-} //namespace test {
-} //namespace intrusive {
-} //namespace boost {
-
-#endif //#ifndef BOOST_INTRUSIVE_TEST_TEST_TEMPLATES_HPP


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