Project

General

Profile

Feature #21

optionally use libatomic for atomic_t

Added by Sage Weil over 8 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
04/13/2010
Due date:
% 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)

History

#1 Updated by Greg Farnum over 8 years ago

  • Assignee set to Greg Farnum
  • Target version set to v0.21
  • Start date changed from 04/12/2010 to 04/13/2010

#2 Updated by Greg Farnum over 8 years ago

  • Status changed from New to Feedback

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!

#3 Updated by Sage Weil over 8 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

#4 Updated by Sage Weil over 8 years ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF