Actions
Feature #21
closedoptionally use libatomic for atomic_t
% Done:
0%
Spent time:
Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Description
libatomic-ops on debian? something like that. unless there's something better.
also, probably drop the CommonC++ one, which has seemed buggy in the past (and is disabled by default)
Updated by Greg Farnum about 14 years ago
- Assignee set to Greg Farnum
- Target version set to v0.21
- Start date changed from 04/12/2010 to 04/13/2010
Updated by Greg Farnum about 14 years ago
- Status changed from New to 4
I've cleaned out all the CommonC++ stuff, which couldn't be used anyway since it didn't match the required interface!
A new libatomic_ops version is also implemented, using memory blocks that I believe should work. Further testing is required to see if it's any faster or more desirable than the spinlock version.
Basic testing seems to indicate it works, though!
Updated by Sage Weil almost 14 years ago
Huh, it looks like STL has some refcounting primitives built in?
From /usr/include/c++/4.3/bits/basic_string.h:
void
_M_dispose(const _Alloc& __a)
{
#ifndef GLIBCXX_FULLY_DYNAMIC_STRING
if (_builtin_expect(this != &_S_empty_rep(), false))
#endif
if (_gnu_cxx::_exchange_and_add_dispatch(&this->M_refcount,
-1) <= 0)
_M_destroy(_a);
} // XXX MT
void
_M_destroy(const _Alloc&) throw();
_CharT*
_M_refcopy() throw()
{
#ifndef GLIBCXX_FULLY_DYNAMIC_STRING
if (_builtin_expect(this != &_S_empty_rep(), false))
#endif
_gnu_cxx::_atomic_add_dispatch(&this->_M_refcount, 1);
return _M_refdata();
} // XXX MT
Actions