[fbreader] Reduced the number of atomic builtins used by the code
This commit is contained in:
parent
b70dd1bcf9
commit
b6a5dd4576
1 changed files with 5 additions and 5 deletions
|
@ -158,8 +158,8 @@ inline T& shared_ptr_storage<T>::content() const {
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void shared_ptr_storage<T>::addReference() {
|
inline void shared_ptr_storage<T>::addReference() {
|
||||||
#if FBREADER_USE_GNUC_SYNC_BUILTINS
|
#if FBREADER_USE_GNUC_SYNC_BUILTINS
|
||||||
__sync_fetch_and_add(&myCounter, 1);
|
__sync_add_and_fetch(&myCounter, 1);
|
||||||
__sync_fetch_and_add(&myTotalCount, 1);
|
__sync_add_and_fetch(&myTotalCount, 1);
|
||||||
#else
|
#else
|
||||||
++myCounter;
|
++myCounter;
|
||||||
#endif
|
#endif
|
||||||
|
@ -186,8 +186,8 @@ inline unsigned int shared_ptr_storage<T>::removeReference() {
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void shared_ptr_storage<T>::addWeakReference() {
|
inline void shared_ptr_storage<T>::addWeakReference() {
|
||||||
#if FBREADER_USE_GNUC_SYNC_BUILTINS
|
#if FBREADER_USE_GNUC_SYNC_BUILTINS
|
||||||
__sync_fetch_and_add(&myWeakCounter, 1);
|
__sync_add_and_fetch(&myWeakCounter, 1);
|
||||||
__sync_fetch_and_add(&myTotalCount, 1);
|
__sync_add_and_fetch(&myTotalCount, 1);
|
||||||
#else
|
#else
|
||||||
++myWeakCounter;
|
++myWeakCounter;
|
||||||
#endif
|
#endif
|
||||||
|
@ -195,7 +195,7 @@ inline void shared_ptr_storage<T>::addWeakReference() {
|
||||||
template<class T>
|
template<class T>
|
||||||
inline unsigned int shared_ptr_storage<T>::removeWeakReference() {
|
inline unsigned int shared_ptr_storage<T>::removeWeakReference() {
|
||||||
#if FBREADER_USE_GNUC_SYNC_BUILTINS
|
#if FBREADER_USE_GNUC_SYNC_BUILTINS
|
||||||
__sync_fetch_and_sub(&myWeakCounter, 1);
|
__sync_sub_and_fetch(&myWeakCounter, 1);
|
||||||
return __sync_sub_and_fetch(&myTotalCount, 1);
|
return __sync_sub_and_fetch(&myTotalCount, 1);
|
||||||
#else
|
#else
|
||||||
--myWeakCounter;
|
--myWeakCounter;
|
||||||
|
|
Loading…
Reference in a new issue