Update of /cvsroot/boost/boost/boost/interprocess/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17964/detail
Modified Files:
atomic.hpp managed_open_or_create_impl.hpp workaround.hpp
Log Message:
Corrected gcc bug in release mode
Index: atomic.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/detail/atomic.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- atomic.hpp 12 May 2007 12:51:19 -0000 1.6
+++ atomic.hpp 23 May 2007 15:47:53 -0000 1.7
@@ -15,6 +15,8 @@
//! limitations under the License.
//////////////////////////////////////////////////////////////////////////////
//
+// This is a modified file (apr_atomic.c) of Apache APR project
+//
// (C) Copyright Ion Gaztanaga 2006. 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)
@@ -30,6 +32,10 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/cstdint.hpp>
+namespace boost{
+namespace interprocess{
+namespace detail{
+
//! Atomically add 'val' to an boost::uint32_t
//! "mem": pointer to the object
//! "val": amount to add
@@ -84,6 +90,10 @@
inline void *atomic_casptr(volatile void **mem, void *with, const void *cmp);
*/
+} //namespace detail{
+} //namespace interprocess{
+} //namespace boost{
+
#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
# include <boost/interprocess/detail/win32_api.hpp>
@@ -157,16 +167,14 @@
} //namespace interprocess{
} //namespace boost{
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-#include <stdlib.h>
+//#include <stdlib.h>
namespace boost {
namespace interprocess {
namespace detail{
-#if (defined(__i386__) || defined(__x86_64__))
-
static boost::uint32_t inline intel_atomic_add32
(volatile boost::uint32_t *mem, boost::uint32_t val)
{
@@ -260,7 +268,15 @@
inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val)
{ *mem = val; }
-#elif (defined(__PPC__) || defined(__ppc__))
+} //namespace detail{
+} //namespace interprocess{
+} //namespace boost{
+
+#elif defined(__GNUC__) && (defined(__PPC__) || defined(__ppc__))
+
+namespace boost {
+namespace interprocess {
+namespace detail{
//! Atomically add 'val' to an boost::uint32_t
//! "mem": pointer to the object
@@ -300,13 +316,13 @@
"cmpw %0,%3\n\t" // does it match cmp?
"bne- 1f\n\t" // ...no, bail out
"stwcx. %2,0,%1\n\t" // ...yes, conditionally
- // store swap
+ // store with
"bne- 0b\n\t" // start over if we lost
// the reservation
"1:" // exit local label
: "=&r"(prev) // output
- : "b" (mem), "r" (swap), "r"(cmp) // inputs
+ : "b" (mem), "r" (with), "r"(cmp) // inputs
: "memory", "cc"); // clobbered
return prev;
}
@@ -352,11 +368,61 @@
inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val)
{ atomic_xchg32(mem, val); }
-#else
+#elif (defined(SOLARIS2) && SOLARIS2 >= 10)
-#error No atomic operations implemented for this platform, sorry!
+#include <atomic.h>
-#endif
+//! Atomically add 'val' to an boost::uint32_t
+//! "mem": pointer to the object
+//! "val": amount to add
+//! Returns the old value pointed to by mem
+inline boost::uint32_t atomic_add32(volatile boost::uint32_t *mem,
boost::uint32_t val)
+{ return atomic_add_32_nv(mem, val) - val; }
+
+//! Compare an boost::uint32_t's value with "cmp".
+//! If they are the same swap the value with "with"
+//! "mem": pointer to the value
+//! "with" what to swap it with
+//! "cmp": the value to compare it to
+//! Returns the old value of *mem
+inline boost::uint32_t atomic_cas32
+ (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)
+{ return atomic_cas_32(mem, cmp, with); }
+
+//! Atomically subtract 'val' from an apr_uint32_t
+//! "mem": pointer to the object
+//! "val": amount to subtract
+inline void atomic_sub32(volatile boost::uint32_t *mem, boost::uint32_t val)
+{ return atomic_add_32(mem, (-val)); }
+
+//! Atomically increment an apr_uint32_t by 1
+//! "mem": pointer to the object
+//! Returns the old value pointed to by mem
+inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem)
+{ return atomic_add_32_nv(mem, 1) - 1; }
+
+//! Atomically decrement an boost::uint32_t by 1
+//! "mem": pointer to the atomic value
+//! Returns false if the value becomes zero on decrement, otherwise true
+inline bool atomic_dec32(volatile boost::uint32_t *mem)
+{ return atomic_add_32_nv(mem, -1) != 0; }
+
+//! Atomically read an boost::uint32_t from memory
+inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem)
+{ return *mem; }
+
+//! Exchange an boost::uint32_t's value with "val".
+//! "mem": pointer to the value
+//! "val": what to swap it with
+//! Returns the old value of *mem
+inline boost::uint32_t atomic_xchg32(volatile boost::uint32_t *mem,
boost::uint32_t val)
+{ return atomic_swap_32(mem, val); }
+
+//! Atomically set an boost::uint32_t in memory
+//! "mem": pointer to the object
+//! "param": val value that the object will assume
+inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val)
+{ *mem = val; }
} //namespace detail{
} //namespace interprocess{
Index: managed_open_or_create_impl.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- managed_open_or_create_impl.hpp 12 May 2007 12:51:19 -0000 1.5
+++ managed_open_or_create_impl.hpp 23 May 2007 15:47:53 -0000 1.6
@@ -61,8 +61,6 @@
m_name = name;
priv_open_or_create
( DoCreate
- , m_mapped_region
- , name
, size
, mode
, addr
@@ -77,8 +75,6 @@
m_name = name;
priv_open_or_create
( DoOpen
- , m_mapped_region
- , name
, 0
, mode
, addr
@@ -95,8 +91,6 @@
m_name = name;
priv_open_or_create
( DoCreateOrOpen
- , m_mapped_region
- , name
, size
, mode
, addr
@@ -114,8 +108,6 @@
m_name = name;
priv_open_or_create
(DoCreate
- , m_mapped_region
- , name
, size
, mode
, addr
@@ -132,8 +124,6 @@
m_name = name;
priv_open_or_create
( DoOpen
- , m_mapped_region
- , name
, 0
, mode
, addr
@@ -151,8 +141,6 @@
m_name = name;
priv_open_or_create
( DoCreateOrOpen
- , m_mapped_region
- , name
, size
, mode
, addr
@@ -253,9 +241,8 @@
}
template <class ConstructFunc> inline
- static void priv_open_or_create
- (create_enum_t type, mapped_region &mregion,
- const char *name, std::size_t size,
+ void priv_open_or_create
+ (create_enum_t type, std::size_t size,
mode_t mode, const void *addr,
ConstructFunc construct_func)
{
@@ -270,12 +257,12 @@
}
if(type == DoOpen){
- DeviceAbstraction tmp(open_only, name, read_write);
+ DeviceAbstraction tmp(open_only, m_name.c_str(), read_write);
tmp.swap(dev);
created = false;
}
else if(type == DoCreate){
- create_device<FileBased>(dev, name, size, file_like_t());
+ create_device<FileBased>(dev, m_name.c_str(), size, file_like_t());
created = true;
}
else if(type == DoCreateOrOpen){
@@ -286,7 +273,7 @@
bool completed = false;
while(!completed){
try{
- create_device<FileBased>(dev, name, size, file_like_t());
+ create_device<FileBased>(dev, m_name.c_str(), size,
file_like_t());
created = true;
completed = true;
}
@@ -296,7 +283,7 @@
}
else{
try{
- DeviceAbstraction tmp(open_only, name, read_write);
+ DeviceAbstraction tmp(open_only, m_name.c_str(),
read_write);
dev.swap(tmp);
created = false;
completed = true;
@@ -327,7 +314,7 @@
write_whole_device<FileBased>(dev, size, file_like_t());
construct_func((char*)region.get_address() +
ManagedOpenOrCreateUserOffset, size - ManagedOpenOrCreateUserOffset, true);
//All ok, just move resources to the external mapped region
- mregion.swap(region);
+ m_mapped_region.swap(region);
}
catch(...){
detail::atomic_write32(patomic_word, CorruptedSegment);
@@ -380,7 +367,7 @@
construct_func((char*)region.get_address() +
ManagedOpenOrCreateUserOffset, region.get_size(), false);
//All ok, just move resources to the external mapped region
- mregion.swap(region);
+ m_mapped_region.swap(region);
}
}
Index: workaround.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/detail/workaround.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- workaround.hpp 12 May 2007 12:51:19 -0000 1.6
+++ workaround.hpp 23 May 2007 15:47:53 -0000 1.7
@@ -62,6 +62,10 @@
#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
#endif
+ #if defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS - 0 > 0)
+ #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
+ #endif
+
#endif
namespace boost {
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs