|
Boost : |
From: atack2_at_[hidden]
Date: 2007-08-21 15:58:09
I remember fixing another PPC atomics.hpp issue a while ago, I'll look at it
tonight.
Where can I read about running the tests? I've not played with that before.
-- Tack ---- Original message ---- >Date: Tue, 21 Aug 2007 21:33:30 +0200 >From: Ion Gaztañaga <igaztanaga_at_[hidden]> >Subject: Re: [boost] [Interprocess] barrier_test hanging on Apple PowerPC >To: "boost_at_[hidden]" <boost_at_[hidden]> > >Doug Gregor wrote: >> The problem only seems to occur on PowerPC Mac, because the test is >> running fine on my Intel Mac. There's a gdb dump of the backtraces >> for all running threads below. > >Removed from SVN. > >The main problem is that Mac does not have process-shared >barrier/mutexes/condition variables and an emulation using spinlocks is >used. Since my knowledge about atomic operations is *zero* my >implementation of interprocess_condition might be wrong or just the >atomic operations I'm using are not correctly implemented. > >I guess I should ask Boost thread-experts (Boost.Thread maintainers >willing to help?) to write these synchronization primitives for me >or/and beg for a simple atomic operation package in Boost. At least some >that implement increment, cas, decrement, atomic read and read (full >barrier semantics are enough for me, I just don't understand what >acquire and release are ;-) ). > >The implementation of the emulated barrier is pretty simple: > >inline barrier::barrier(unsigned int count) > : m_threshold(count), m_count(count), m_generation(0) >{ > if (count == 0) > throw std::invalid_argument("count cannot be zero."); >} > >inline bool barrier::wait() >{ > scoped_lock<interprocess_mutex> lock(m_mutex); > unsigned int gen = m_generation; > > if (--m_count == 0){ > m_generation++; > m_count = m_threshold; > m_cond.notify_all(); > return true; > } > > while (gen == m_generation){ > m_cond.wait(lock); > } > return false; >} > >so I guess there is problem with my emulated condition implementation or >with atomic operations (which are taken from apache run-time library). > >Regards, > >Ion >_______________________________________________ >Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/ boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk