|
Boost : |
Subject: Re: [boost] [Lockfree review] Meta-comments
From: Tim Blechmann (tim_at_[hidden])
Date: 2011-07-26 17:14:26
> >> Matt, how have you measured the stability? One of my main concerns
> >> with Atomic is that it seems to lack any tests, so it is hard to know
> >> whether it is actually working correctly or not. (Doing the correct
> >> operation but non-atomically, or without the required memory barriers,
> >> would often appear to work perfectly.)
> >
> > well, i am not sure, whether it can be tested for full correctness. i
> > suppose all we can do is to compile-tests, for the rest we would have to
> > review the code.
>
> At the very least, you can e.g. run two threads that inc and dec a
> shared atomic variable and verify that you get the expected answer.
> I'm sure that someone with some experience in this area would have many
> more ideas.
in this case, one will have atomic operations
> > * gcc-4.6 (and probably earlier) cannot compile boost.lockfree with
> > std::atomic
> >
> > i suspect, their implementation is still incomplete
>
> Can you tell us more about that? Perhaps it points to an issue with
> boost.lockfree that reviewers might be interested in.
many undefined references to std::atomic members:
queue.cpp:(.text+0x48): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::load(std::memory_order) const'
queue.cpp:(.text+0x9f): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>&,
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
queue.cpp:(.text+0xc4): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0xed): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text+0x106): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x11c): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x135): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x176): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_strong(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text+0x1af): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text+0x1e5): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_strong(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
CMakeFiles/queue.dir/queue.cpp.o: In function `consumer()':
queue.cpp:(.text+0x24e): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x26c): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x282): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x29b): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x2f8): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text+0x31b): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::load(std::memory_order) const'
queue.cpp:(.text+0x369): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>&,
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
queue.cpp:(.text+0x3c4): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_strong(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text+0x3ea): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x3fe): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x415): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x42c): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:(.text+0x493): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text+0x4b7): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::load(std::memory_order) const'
queue.cpp:(.text+0x50f): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>&,
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
queue.cpp:(.text+0x566): undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>
>::compare_exchange_strong(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node>, std::memory_order)'
CMakeFiles/queue.dir/queue.cpp.o: In function `main':
queue.cpp:(.text.startup+0x39): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::is_lock_free() const'
queue.cpp:(.text.startup+0xad4): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::is_lock_free() const'
queue.cpp:(.text.startup+0xae6): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::is_lock_free() const'
CMakeFiles/queue.dir/queue.cpp.o: In function `_GLOBAL__sub_I_producer_count':
queue.cpp:(.text.startup+0x145f): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:(.text.startup+0x1478): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>, std::memory_order)'
CMakeFiles/queue.dir/queue.cpp.o: In function `boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::~freelist_stack()':
queue.cpp:
(.text._ZN5boost8lockfree6detail14freelist_stackINS0_5queueIiNS_9parameter5void_ES5_E4nodeELb0ESaIS7_EED2Ev[_ZN5boost8lockfree6detail14freelist_stackINS0_5queueIiNS_9parameter5void_ES5_E4nodeELb0ESaIS7_EED5Ev]+0x16):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::operator
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>() const'
CMakeFiles/queue.dir/queue.cpp.o: In function `boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::~queue()':
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x23):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x36):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x54):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0xab):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0xbf):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x10f):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x148):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node>, std::memory_order)'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x15a):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_,
boost::parameter::void_>::node> >::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x17d):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x1dd):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>&,
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
queue.cpp:
(.text._ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED2Ev[_ZN5boost8lockfree5queueIiNS_9parameter5void_ES3_ED5Ev]+0x1f8):
undefined reference to `std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::operator
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>() const'
CMakeFiles/queue.dir/queue.cpp.o: In function `boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::reserve_unsafe(unsigned long)':
queue.cpp:
(.text._ZN5boost8lockfree6detail14freelist_stackINS0_5queueIiNS_9parameter5void_ES5_E4nodeELb0ESaIS7_EE14reserve_unsafeEm[boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::reserve_unsafe(unsigned long)]+0x42): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree6detail14freelist_stackINS0_5queueIiNS_9parameter5void_ES5_E4nodeELb0ESaIS7_EE14reserve_unsafeEm[boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::reserve_unsafe(unsigned long)]+0x86): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
CMakeFiles/queue.dir/queue.cpp.o: In function `boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::allocate()':
queue.cpp:
(.text._ZN5boost8lockfree6detail14freelist_stackINS0_5queueIiNS_9parameter5void_ES5_E4nodeELb0ESaIS7_EE8allocateEv[boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::allocate()]+0x1f): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node> >::load(std::memory_order) const'
queue.cpp:
(.text._ZN5boost8lockfree6detail14freelist_stackINS0_5queueIiNS_9parameter5void_ES5_E4nodeELb0ESaIS7_EE8allocateEv[boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node, false, std::allocator<boost::lockfree::queue<int,
boost::parameter::void_, boost::parameter::void_>::node> >::allocate()]+0x66): undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>&,
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_node>, std::memory_order)'
cheers, tim
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk