Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54334 - in trunk/boost/interprocess: . containers/container detail streams sync sync/emulation sync/posix
From: igaztanaga_at_[hidden]
Date: 2009-06-25 11:47:54


Author: igaztanaga
Date: 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
New Revision: 54334
URL: http://svn.boost.org/trac/boost/changeset/54334

Log:
Boost 1.40 changes
Text files modified:
   trunk/boost/interprocess/containers/container/vector.hpp | 34 ++++--
   trunk/boost/interprocess/detail/workaround.hpp | 12 ++
   trunk/boost/interprocess/interprocess_fwd.hpp | 2
   trunk/boost/interprocess/mapped_region.hpp | 7 +
   trunk/boost/interprocess/shared_memory_object.hpp | 2
   trunk/boost/interprocess/streams/vectorstream.hpp | 193 ++++++++++++++++++++-------------------
   trunk/boost/interprocess/sync/emulation/interprocess_semaphore.hpp | 8 +
   trunk/boost/interprocess/sync/interprocess_semaphore.hpp | 2
   trunk/boost/interprocess/sync/named_semaphore.hpp | 12 +-
   trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp | 2
   trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp | 4
   11 files changed, 155 insertions(+), 123 deletions(-)

Modified: trunk/boost/interprocess/containers/container/vector.hpp
==============================================================================
--- trunk/boost/interprocess/containers/container/vector.hpp (original)
+++ trunk/boost/interprocess/containers/container/vector.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -1336,6 +1336,8 @@
 
    void priv_range_insert_expand_forward(T* pos, size_type n, advanced_insert_aux_int_t &interf)
    {
+ //n can't be 0, because there is nothing to do in that case
+ if(!n) return;
       //There is enough memory
       T* old_finish = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
       const size_type elems_after = old_finish - pos;
@@ -1367,7 +1369,8 @@
    void priv_range_insert_new_allocation
       (T* new_start, size_type new_cap, T* pos, size_type n, advanced_insert_aux_int_t &interf)
    {
- T* new_finish = new_start;
+ //n can be zero, if we want to reallocate!
+ T *new_finish = new_start;
       T *old_finish;
       //Anti-exception rollbacks
       typename value_traits::UCopiedArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
@@ -1375,36 +1378,40 @@
 
       //Initialize with [begin(), pos) old buffer
       //the start of the new buffer
- new_finish = boost::interprocess::uninitialized_move
- (containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish);
- constructed_values_destroyer.increment_size(new_finish - old_finish);
+ T *old_buffer = containers_detail::get_pointer(this->members_.m_start);
+ if(old_buffer){
+ new_finish = boost::interprocess::uninitialized_move
+ (containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish);
+ constructed_values_destroyer.increment_size(new_finish - old_finish);
+ }
       //Initialize new objects, starting from previous point
       interf.uninitialized_copy_all_to(old_finish = new_finish);
       new_finish += n;
       constructed_values_destroyer.increment_size(new_finish - old_finish);
       //Initialize from the rest of the old buffer,
       //starting from previous point
- new_finish = boost::interprocess::uninitialized_move
- ( pos, containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size, new_finish);
- //All construction successful, disable rollbacks
- constructed_values_destroyer.release();
- scoped_alloc.release();
- //Destroy and deallocate old elements
- //If there is allocated memory, destroy and deallocate
- if(this->members_.m_start != 0){
+ if(old_buffer){
+ new_finish = boost::interprocess::uninitialized_move
+ (pos, old_buffer + this->members_.m_size, new_finish);
+ //Destroy and deallocate old elements
+ //If there is allocated memory, destroy and deallocate
          if(!value_traits::trivial_dctr_after_move)
- this->destroy_n(containers_detail::get_pointer(this->members_.m_start), this->members_.m_size);
+ this->destroy_n(old_buffer, this->members_.m_size);
          this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
       }
       this->members_.m_start = new_start;
       this->members_.m_size = new_finish - new_start;
       this->members_.m_capacity = new_cap;
+ //All construction successful, disable rollbacks
+ constructed_values_destroyer.release();
+ scoped_alloc.release();
    }
 
    void priv_range_insert_expand_backwards
          (T* new_start, size_type new_capacity,
           T* pos, const size_type n, advanced_insert_aux_int_t &interf)
    {
+ //n can be zero to just expand capacity
       //Backup old data
       T* old_start = containers_detail::get_pointer(this->members_.m_start);
       T* old_finish = old_start + this->members_.m_size;
@@ -1753,7 +1760,6 @@
          if (this->size() >= n){
             //There is memory, but there are more old elements than new ones
             //Overwrite old elements with new ones
- assert(start);
             std::copy(first, last, start);
             //Destroy remaining old elements
             this->destroy_n(start + n, this->members_.m_size - n);

Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -62,6 +62,11 @@
    #else
    #endif
 
+ //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
+ #if !defined(__QNXNTO__)
+ # define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
+ #endif
+
    #if ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
    # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
    #else
@@ -70,13 +75,18 @@
    # if __CRTL_VER >= 70200000
    # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
    # endif
- # define BOOST_INTERPROCESS_SYSTEM_V_SHARED_MEMORY_OBJECTS
    //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
    //# elif defined (__APPLE__)
    //# define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
    # endif
    #endif
 
+ //Now check if we have only XSI shared memory
+ #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\
+ !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
+ //# define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
+ #endif
+
    #if ((_POSIX_TIMEOUTS - 0) > 0)
    # define BOOST_INTERPROCESS_POSIX_TIMEOUTS
    #endif

Modified: trunk/boost/interprocess/interprocess_fwd.hpp
==============================================================================
--- trunk/boost/interprocess/interprocess_fwd.hpp (original)
+++ trunk/boost/interprocess/interprocess_fwd.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -254,6 +254,7 @@
 
 #else
 
+#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
 template <class CharType
          ,class MemoryAlgorithm
          ,template<class IndexConfig> class IndexType>
@@ -270,6 +271,7 @@
    ,rbtree_best_fit<mutex_family>
    ,iset_index>
 wmanaged_xsi_shared_memory;
+#endif //#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
 
 #endif //#if defined (BOOST_INTERPROCESS_WINDOWS)
 

Modified: trunk/boost/interprocess/mapped_region.hpp
==============================================================================
--- trunk/boost/interprocess/mapped_region.hpp (original)
+++ trunk/boost/interprocess/mapped_region.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -397,6 +397,8 @@
 {
    mapping_handle_t map_hnd = mapping.get_mapping_handle();
 
+ //Some systems dont' support XSI shared memory
+ #ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
    if(map_hnd.is_xsi){
       //Get the size
       ::shmid_ds xsi_ds;
@@ -435,10 +437,9 @@
       m_mode = mode;
       m_extra_offset = 0;
       m_is_xsi = true;
-
       return;
    }
-
+ #endif //ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
    if(size == 0){
       offset_t filesize = lseek
          (map_hnd.handle, offset, SEEK_END);
@@ -548,12 +549,14 @@
 inline void mapped_region::priv_close()
 {
    if(m_base != MAP_FAILED){
+ #ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
       if(m_is_xsi){
          int ret = ::shmdt(m_base);
          assert(ret == 0);
          (void)ret;
          return;
       }
+ #endif //#ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
       munmap(static_cast<char*>(m_base) - m_extra_offset, m_size + m_extra_offset);
       m_base = MAP_FAILED;
    }

Modified: trunk/boost/interprocess/shared_memory_object.hpp
==============================================================================
--- trunk/boost/interprocess/shared_memory_object.hpp (original)
+++ trunk/boost/interprocess/shared_memory_object.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -24,7 +24,7 @@
 #include <string>
 #include <algorithm>
 
-#if defined(BOOST_INTERPROCESS_SYSTEM_V_SHARED_MEMORY_OBJECTS)
+#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY)
 # include <sys/shm.h> //System V shared memory...
 #elif defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
 # include <fcntl.h> //O_CREAT, O_*...

Modified: trunk/boost/interprocess/streams/vectorstream.hpp
==============================================================================
--- trunk/boost/interprocess/streams/vectorstream.hpp (original)
+++ trunk/boost/interprocess/streams/vectorstream.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -108,23 +108,12 @@
             //Restore the vector's size if necessary
             mp_high_water = base_t::pptr();
          }
+ //This does not reallocate
          m_vect.resize(mp_high_water - (m_vect.size() ? &m_vect[0] : 0));
-
- //Now swap vector
- m_vect.swap(vect);
-
- //If the stream is writable put the high water mark
- //and maximize the size.
- typename vector_type::size_type old_size = m_vect.size();
- m_vect.resize(m_vect.capacity());
- this->initialize_pointers();
- mp_high_water = old_size ? &m_vect[0] + old_size : 0;
- }
- else{
- //Now swap vector
- m_vect.swap(vect);
- this->initialize_pointers();
       }
+ //Now swap vector
+ m_vect.swap(vect);
+ this->initialize_pointers();
    }
 
    //!Returns a const reference to the internal vector.
@@ -136,8 +125,17 @@
             //Restore the vector's size if necessary
             mp_high_water = base_t::pptr();
          }
- m_vect.resize(mp_high_water - (m_vect.size() ? &m_vect[0] : 0));
- const_cast<basic_vectorbuf * const>(this)->initialize_pointers();
+ //This shouldn't reallocate
+ typedef typename vector_type::size_type size_type;
+ char_type *old_ptr = base_t::pbase();
+ size_type high_pos = size_type(mp_high_water-old_ptr);
+ if(m_vect.size() > high_pos){
+ m_vect.resize(high_pos);
+ //But we must update end write pointer because vector size is now shorter
+ int old_pos = base_t::pptr() - base_t::pbase();
+ const_cast<basic_vectorbuf*>(this)->base_t::setp(old_ptr, old_ptr + high_pos);
+ const_cast<basic_vectorbuf*>(this)->base_t::pbump(old_pos);
+ }
       }
       return m_vect;
    }
@@ -147,25 +145,33 @@
    //!Throws if the internals vector's memory allocation throws.
    void reserve(typename vector_type::size_type size)
    {
- m_vect.reserve(size);
- //Now update pointer data
- typename vector_type::size_type old_size = m_vect.size();
- m_vect.resize(m_vect.capacity());
- this->initialize_pointers();
- mp_high_water = old_size ? &m_vect[0] + old_size : 0;
+ if (this->m_mode & std::ios_base::out && size > m_vect.size()){
+ typename vector_type::difference_type write_pos = base_t::pptr() - base_t::pbase();
+ typename vector_type::difference_type read_pos = base_t::gptr() - base_t::eback();
+ //Now update pointer data
+ m_vect.reserve(size);
+ this->initialize_pointers();
+ base_t::pbump((int)write_pos);
+ if(this->m_mode & std::ios_base::in){
+ base_t::gbump((int)read_pos);
+ }
+ }
    }
 
    //!Calls clear() method of the internal vector.
    //!Resets the stream to the first position.
- void clear()
+ void clear()
    { m_vect.clear(); this->initialize_pointers(); }
 
    /// @cond
    private:
+ //Maximizes high watermark to the initial vector size,
+ //initializes read and write iostream buffers to the capacity
+ //and resets stream positions
    void initialize_pointers()
    {
       // The initial read position is the beginning of the vector.
- if(m_mode & std::ios_base::in){
+ if(!(m_mode & std::ios_base::out)){
          if(m_vect.empty()){
             this->setg(0, 0, 0);
          }
@@ -176,17 +182,29 @@
 
       // The initial write position is the beginning of the vector.
       if(m_mode & std::ios_base::out){
+ //First get real size
+ int real_size = (int)m_vect.size();
+ //Then maximize size for high watermarking
+ m_vect.resize(m_vect.capacity());
+ assert(m_vect.size() == m_vect.capacity());
+ //Set high watermarking with the expanded size
+ mp_high_water = m_vect.size() ? (&m_vect[0] + real_size) : 0;
+ //Now set formatting pointers
          if(m_vect.empty()){
             this->setp(0, 0);
+ if(m_mode & std::ios_base::in)
+ this->setg(0, 0, 0);
          }
          else{
- this->setp(&m_vect[0], &m_vect[0] + m_vect.size());
+ char_type *p = &m_vect[0];
+ this->setp(p, p + m_vect.size());
+ if(m_mode & std::ios_base::in)
+ this->setg(p, p, p + real_size);
+ }
+ if (m_mode & (std::ios_base::app | std::ios_base::ate)){
+ base_t::pbump((int)real_size);
          }
-
- if (m_mode & (std::ios_base::app | std::ios_base::ate))
- base_t::pbump((int)m_vect.size());
       }
- mp_high_water = m_vect.empty() ? 0 : (&m_vect[0] + m_vect.size());
    }
 
    protected:
@@ -194,10 +212,12 @@
    {
       if (base_t::gptr() == 0)
          return CharTraits::eof();
- if (mp_high_water < base_t::pptr())
- mp_high_water = base_t::pptr();
- if (base_t::egptr() < mp_high_water)
- base_t::setg(base_t::eback(), base_t::gptr(), mp_high_water);
+ if(m_mode & std::ios_base::out){
+ if (mp_high_water < base_t::pptr())
+ mp_high_water = base_t::pptr();
+ if (base_t::egptr() < mp_high_water)
+ base_t::setg(base_t::eback(), base_t::gptr(), mp_high_water);
+ }
       if (base_t::gptr() < base_t::egptr())
          return CharTraits::to_int_type(*base_t::gptr());
       return CharTraits::eof();
@@ -232,48 +252,27 @@
    {
       if(m_mode & std::ios_base::out) {
          if(!CharTraits::eq_int_type(c, CharTraits::eof())) {
-// if(!(m_mode & std::ios_base::in)) {
-// if(this->pptr() < this->epptr()) {
-// *this->pptr() = CharTraits::to_char_type(c);
-// this->pbump(1);
-// if (mp_high_water < base_t::pptr())
-// mp_high_water = base_t::pptr();
-// if ((m_mode & std::ios_base::in) && base_t::egptr() < mp_high_water)
-// base_t::setg(base_t::eback(), base_t::gptr(), mp_high_water);
-// return c;
-// }
-// else
-// return CharTraits::eof();
-// }
-// else {
-// try{
- typedef typename vector_type::difference_type dif_t;
- dif_t inpos = base_t::gptr() - base_t::eback();
- //The new output position is the previous one plus one
- //because 'overflow' requires putting 'c' on the buffer
- dif_t new_outpos = base_t::pptr() - base_t::pbase() + 1;
- //Adjust high water if necessary
- dif_t hipos = mp_high_water - base_t::pbase();
- if (hipos < new_outpos)
- hipos = new_outpos;
- //Insert the new data
- m_vect.push_back(CharTraits::to_char_type(c));
- m_vect.resize(m_vect.capacity());
- char_type* p = const_cast<char_type*>(&m_vect[0]);
- //A reallocation has happened, update pointers
- if (m_mode & std::ios_base::in)
- base_t::setg(p, p + inpos, p + hipos);
- base_t::setp(p, p + (dif_t)m_vect.size());
- //Update write position to the old position + 1
- base_t::pbump((int)new_outpos);
- //Update high water pointer, since the buffer has been reallocated
- mp_high_water = base_t::pbase() + hipos;
- return c;
-// }
-// catch(...){
-// return CharTraits::eof();
-// }
-// }
+ typedef typename vector_type::difference_type dif_t;
+ //The new output position is the previous one plus one
+ //because 'overflow' requires putting 'c' on the buffer
+ dif_t new_outpos = base_t::pptr() - base_t::pbase() + 1;
+ //Adjust high water if necessary
+ dif_t hipos = mp_high_water - base_t::pbase();
+ if (hipos < new_outpos)
+ hipos = new_outpos;
+ //Insert the new data
+ m_vect.push_back(CharTraits::to_char_type(c));
+ m_vect.resize(m_vect.capacity());
+ assert(m_vect.size() == m_vect.capacity());
+ char_type* p = const_cast<char_type*>(&m_vect[0]);
+ //A reallocation might have happened, update pointers
+ base_t::setp(p, p + (dif_t)m_vect.size());
+ mp_high_water = p + hipos;
+ if (m_mode & std::ios_base::in)
+ base_t::setg(p, p + (base_t::gptr() - base_t::eback()), mp_high_water);
+ //Update write position to the old position + 1
+ base_t::pbump((int)new_outpos);
+ return c;
          }
          else // c is EOF, so we don't have to do anything
             return CharTraits::not_eof(c);
@@ -286,21 +285,12 @@
                               std::ios_base::openmode mode
                                  = std::ios_base::in | std::ios_base::out)
    {
- bool in = false, out = false;
-
- const std::ios_base::openmode inout =
- std::ios_base::in | std::ios_base::out;
-
- if((mode & inout) == inout) {
- if(dir == std::ios_base::beg || dir == std::ios_base::end)
- in = out = true;
- }
- else if(mode & std::ios_base::in)
- in = true;
- else if(mode & std::ios_base::out)
- out = true;
-
- if(!in && !out)
+ //Get seek mode
+ bool in(0 != (mode & std::ios_base::in)), out(0 != (mode & std::ios_base::out));
+ //Test for logic errors
+ if(!in & !out)
+ return pos_type(off_type(-1));
+ else if((in && out) && (dir == std::ios_base::cur))
          return pos_type(off_type(-1));
       else if((in && (!(m_mode & std::ios_base::in) || this->gptr() == 0)) ||
                (out && (!(m_mode & std::ios_base::out) || this->pptr() == 0)))
@@ -310,8 +300,22 @@
       //Just calculate the end of the stream. If the stream is read-only
       //the limit is the size of the vector. Otherwise, the high water mark
       //will mark the real size.
- off_type limit = static_cast<off_type> (mode & std::ios_base::out ?
- mp_high_water - base_t::pbase() : m_vect.size()/*mp_high_water - base_t::eback()*/);
+ off_type limit;
+ if(m_mode & std::ios_base::out){
+ //Update high water marking because pptr() is going to change and it might
+ //have been updated since last overflow()
+ if(mp_high_water < base_t::pptr())
+ mp_high_water = base_t::pptr();
+ //Update read limits in case high water mark was changed
+ if(m_mode & std::ios_base::in){
+ if (base_t::egptr() < mp_high_water)
+ base_t::setg(base_t::eback(), base_t::gptr(), mp_high_water);
+ }
+ limit = static_cast<off_type>(mp_high_water - base_t::pbase());
+ }
+ else{
+ limit = static_cast<off_type>(m_vect.size());
+ }
 
       switch(dir) {
          case std::ios_base::beg:
@@ -334,6 +338,9 @@
          return pos_type(-1);
       if (m_mode & std::ios_base::app && mode & std::ios_base::out && newoff != limit)
          return pos_type(-1);
+ //This can reassign pointers
+ //if(m_vect.size() != m_vect.capacity())
+ //this->initialize_pointers();
       if (in)
          base_t::setg(base_t::eback(), base_t::eback() + newoff, base_t::egptr());
       if (out){

Modified: trunk/boost/interprocess/sync/emulation/interprocess_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/emulation/interprocess_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/emulation/interprocess_semaphore.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -18,9 +18,13 @@
 inline interprocess_semaphore::~interprocess_semaphore()
 {}
 
-inline interprocess_semaphore::interprocess_semaphore(int initialCount)
+inline interprocess_semaphore::interprocess_semaphore(unsigned int initialCount)
    : m_mut(), m_cond(), m_count(initialCount)
-{}
+{
+ if(m_count < 0){
+ throw interprocess_exception(size_error);
+ }
+}
 
 inline void interprocess_semaphore::post()
 {

Modified: trunk/boost/interprocess/sync/interprocess_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_semaphore.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -62,7 +62,7 @@
    public:
    //!Creates a interprocess_semaphore with the given initial count.
    //!interprocess_exception if there is an error.*/
- interprocess_semaphore(int initialCount);
+ interprocess_semaphore(unsigned int initialCount);
 
    //!Destroys the interprocess_semaphore.
    //!Does not throw

Modified: trunk/boost/interprocess/sync/named_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/named_semaphore.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -53,7 +53,7 @@
    public:
    //!Creates a global semaphore with a name, and an initial count.
    //!If the semaphore can't be created throws interprocess_exception
- named_semaphore(create_only_t, const char *name, int initialCount);
+ named_semaphore(create_only_t, const char *name, unsigned int initialCount);
 
    //!Opens or creates a global semaphore with a name, and an initial count.
    //!If the semaphore is created, this call is equivalent to
@@ -61,7 +61,7 @@
    //!If the semaphore is already created, this call is equivalent to
    //!named_semaphore(open_only_t, ... )
    //!and initialCount is ignored.
- named_semaphore(open_or_create_t, const char *name, int initialCount);
+ named_semaphore(open_or_create_t, const char *name, unsigned int initialCount);
 
    //!Opens a global semaphore with a name if that semaphore is previously.
    //!created. If it is not previously created this function throws
@@ -124,12 +124,12 @@
 #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES)
 
 inline named_semaphore::named_semaphore
- (create_only_t, const char *name, int initialCount)
+ (create_only_t, const char *name, unsigned int initialCount)
    : m_sem(detail::DoCreate, name, read_write, initialCount)
 {}
 
 inline named_semaphore::named_semaphore
- (open_or_create_t, const char *name, int initialCount)
+ (open_or_create_t, const char *name, unsigned int initialCount)
    : m_sem(detail::DoOpenOrCreate, name, read_write, initialCount)
 {}
 
@@ -174,7 +174,7 @@
 { detail::interprocess_tester::dont_close_on_destruction(m_shmem); }
 
 inline named_semaphore::named_semaphore
- (create_only_t, const char *name, int initialCount)
+ (create_only_t, const char *name, unsigned int initialCount)
    : m_shmem (create_only
                ,name
                ,sizeof(interprocess_semaphore) +
@@ -186,7 +186,7 @@
 {}
 
 inline named_semaphore::named_semaphore
- (open_or_create_t, const char *name, int initialCount)
+ (open_or_create_t, const char *name, unsigned int initialCount)
    : m_shmem (open_or_create
                ,name
                ,sizeof(interprocess_semaphore) +

Modified: trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/posix/interprocess_semaphore.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -18,7 +18,7 @@
 inline interprocess_semaphore::~interprocess_semaphore()
 {}
 
-inline interprocess_semaphore::interprocess_semaphore(int initialCount)
+inline interprocess_semaphore::interprocess_semaphore(unsigned int initialCount)
    : m_sem(initialCount)
 {}
 

Modified: trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp (original)
+++ trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp 2009-06-25 11:47:52 EDT (Thu, 25 Jun 2009)
@@ -119,7 +119,7 @@
    }
 }
 
-inline void semaphore_init(sem_t *handle, int initialCount)
+inline void semaphore_init(sem_t *handle, unsigned int initialCount)
 {
    int ret = sem_init(handle, 1, initialCount);
    //According to SUSV3 version 2003 edition, the return value of a successful
@@ -243,7 +243,7 @@
    semaphore_wrapper &operator= (const semaphore_wrapper &);
 
    public:
- semaphore_wrapper(int initialCount)
+ semaphore_wrapper(unsigned int initialCount)
    { semaphore_init(&m_sem, initialCount); }
 
    ~semaphore_wrapper()


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