#3750 closed Bugs (wontfix)
atomic_cas32 not working for Sun Solaris 10
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | Boost 1.42.0 | Component: | interprocess |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | atomic_cas32 on Sun solaris 10 | Cc: | saurabh.pandey@… |
Description
#include <iostream> #include "boost/interprocess/detail/atomic.hpp"
boost::uint32_t m_contextId = 0; long rtIncrContextId() {
boost::uint32_t contextId = -1; boost::uint32_t oldValue = -1; do {
oldValue = m_contextId; contextId = m_contextId + 1; if(boost::interprocess::detail::atomic_cas32((volatile boost::uint32_t *)&m_contextId,contextId,oldValue) == oldValue)
break;
}while (true); return contextId;
}
int main() {
std::cout << " \n Value of m_contextId " << m_contextId;
rtIncrContextId();
std::cout << " \n Value of m_contextId " << m_contextId << std::endl;
} The above program is not working on sun solaris 10 using sparc. g++ version is 4.4.2 and because of this sun sparc specific atomic operation are not being used . Instead following function is used #elif defined(GNUC) && ( GNUC * 100 + GNUC_MINOR >= 401 )
inline boost::uint32_t atomic_cas32
(volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)
{ return sync_val_compare_and_swap(const_cast<boost::uint32_t *>(mem), with, cmp); }
Change History (3)
comment:1 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 11 years ago
I have a similar problem compiling my program under Solaris10. If I just declare a named_upgradable_mutex like this:
named_upgradable_mutex n_u_mutex(open_or_create, "ipc_pri_queue_upgradable_mutex");
I get the error:
g++ -O3 -I /usr/local/boost_1_49_0 -c main.cpp -o main.o /usr/local/boost_1_49_0/boost/interprocess/detail/atomic.hpp: In member function 'void boost::interprocess::ipcdetail::managed_open_or_create_impl<DeviceAbstraction, MemAlignment, FileBased, StoreDevice>::priv_open_or_create(boost::interprocess::ipcdetail::create_enum_t, const typename boost::interprocess::managed_open_or_create_impl_device_id_t<DeviceAbstraction>::type&, size_t, boost::interprocess::mode_t, const void*, const boost::interprocess::permissions&, ConstructFunc) [with ConstructFunc = boost::interprocess::ipcdetail::named_creation_functor<boost::interprocess::interprocess_upgradable_mutex, boost::interprocess::ipcdetail::named_creation_functor_no_arg>, DeviceAbstraction = boost::interprocess::shared_memory_object, unsigned int MemAlignment = 0u, bool FileBased = true, bool StoreDevice = true]': /usr/local/boost_1_49_0/boost/interprocess/detail/atomic.hpp:316: internal compiler error: in rewrite_stmt, at tree-into-ssa.c:1380 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://forum.java.sun.com/forum.jspa?forumID=905> for instructions. * Error code 1 make: Fatal error: Command failed for target `main.o'
I'm using GCC: sparc-sun-solaris2.10-g++ (GCC) 4.2.1 (20090222) (gccfss)
Is there a solution to this?
Sorry but I can find a solution for this without help and a patch. I will pass this to wontfix until then.