Commit 50afe6f0 by Christian Kern

Revert not bool implementation, which was a hotfix for the ARMv7 bug.

This reverts commit 807308ab819e778915b8a6c5c5cdb68288233f72.
This reverts commit 399ddba00be2f45a4768f4a2e92d1c12d3e75552.
parent cd283998
...@@ -97,18 +97,18 @@ FixedSizeList<ElementT>::~FixedSizeList() { ...@@ -97,18 +97,18 @@ FixedSizeList<ElementT>::~FixedSizeList() {
template< typename GuardType > template< typename GuardType >
bool HazardPointerThreadEntry<GuardType>::IsActive() { bool HazardPointerThreadEntry<GuardType>::IsActive() {
return (is_active == 1); return is_active;
} }
template< typename GuardType > template< typename GuardType >
bool HazardPointerThreadEntry<GuardType>::TryReserve() { bool HazardPointerThreadEntry<GuardType>::TryReserve() {
int expected = 0; bool expected = false;
return is_active.CompareAndSwap(expected, 1); return is_active.CompareAndSwap(expected, true);
} }
template< typename GuardType > template< typename GuardType >
void HazardPointerThreadEntry<GuardType>::Deactivate() { void HazardPointerThreadEntry<GuardType>::Deactivate() {
is_active = 0; is_active = false;
} }
template< typename GuardType > template< typename GuardType >
...@@ -198,10 +198,7 @@ GuardPointer(int guardNumber, GuardType pointerToGuard) { ...@@ -198,10 +198,7 @@ GuardPointer(int guardNumber, GuardType pointerToGuard) {
template< typename GuardType > template< typename GuardType >
void HazardPointerThreadEntry<GuardType>::SetActive(bool active) { void HazardPointerThreadEntry<GuardType>::SetActive(bool active) {
if (active == true) is_active = active;
is_active = 1;
else
is_active = 0;
} }
template< typename GuardType > template< typename GuardType >
......
...@@ -201,7 +201,7 @@ class HazardPointerThreadEntry { ...@@ -201,7 +201,7 @@ class HazardPointerThreadEntry {
* signal that it is leaving. If a thread has left, the other threads are * signal that it is leaving. If a thread has left, the other threads are
* responsible for cleaning up its retired list. * responsible for cleaning up its retired list.
*/ */
embb::base::Atomic< int > is_active; embb::base::Atomic< bool > is_active;
/** /**
* The guarded pointer of this thread, has size \c guard_per_thread. * The guarded pointer of this thread, has size \c guard_per_thread.
......
...@@ -99,7 +99,7 @@ GetIndexOfObject(const T &obj) const { ...@@ -99,7 +99,7 @@ GetIndexOfObject(const T &obj) const {
template<class T, typename ValuePool, class ObjectAllocator> template<class T, typename ValuePool, class ObjectAllocator>
T* ObjectPool<T, ValuePool, ObjectAllocator>::AllocateRaw() { T* ObjectPool<T, ValuePool, ObjectAllocator>::AllocateRaw() {
int val; bool val;
int allocated_index = p.Allocate(val); int allocated_index = p.Allocate(val);
if (allocated_index == -1) { if (allocated_index == -1) {
return NULL; return NULL;
...@@ -128,7 +128,7 @@ void ObjectPool<T, ValuePool, ObjectAllocator>::Free(T* obj) { ...@@ -128,7 +128,7 @@ void ObjectPool<T, ValuePool, ObjectAllocator>::Free(T* obj) {
int index = GetIndexOfObject(*obj); int index = GetIndexOfObject(*obj);
obj->~T(); obj->~T();
p.Free(1, index); p.Free(true, index);
} }
template<class T, typename ValuePool, class ObjectAllocator> template<class T, typename ValuePool, class ObjectAllocator>
......
...@@ -105,7 +105,7 @@ class LockFreeMPMCQueueNode { ...@@ -105,7 +105,7 @@ class LockFreeMPMCQueueNode {
* which stores the elements. * which stores the elements.
*/ */
template< typename T, template< typename T,
typename ValuePool = embb::containers::LockFreeTreeValuePool < int, 0 > typename ValuePool = embb::containers::LockFreeTreeValuePool < bool, false >
> >
class LockFreeMPMCQueue { class LockFreeMPMCQueue {
private: private:
......
...@@ -170,7 +170,7 @@ class LockFreeStackNode { ...@@ -170,7 +170,7 @@ class LockFreeStackNode {
* which stores the elements. * which stores the elements.
*/ */
template< typename T, template< typename T,
typename ValuePool = embb::containers::LockFreeTreeValuePool < int, 0 > > typename ValuePool = embb::containers::LockFreeTreeValuePool < bool, false > >
class LockFreeStack { class LockFreeStack {
private: private:
/** /**
......
...@@ -55,7 +55,7 @@ namespace containers { ...@@ -55,7 +55,7 @@ namespace containers {
*/ */
template<class T, template<class T,
typename ValuePool = typename ValuePool =
embb::containers::WaitFreeArrayValuePool< int, 0 >, embb::containers::WaitFreeArrayValuePool< bool, false >,
class ObjectAllocator = embb::base::Allocator<T> > class ObjectAllocator = embb::base::Allocator<T> >
class ObjectPool { class ObjectPool {
private: private:
...@@ -87,9 +87,9 @@ class ObjectPool { ...@@ -87,9 +87,9 @@ class ObjectPool {
class ReturningTrueIterator { class ReturningTrueIterator {
public: public:
typedef ReturningTrueIterator self_type; typedef ReturningTrueIterator self_type;
typedef int value_type; typedef bool value_type;
typedef int& reference; typedef bool& reference;
typedef int* pointer; typedef bool* pointer;
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
typedef int difference_type; typedef int difference_type;
explicit ReturningTrueIterator(size_t count_value); explicit ReturningTrueIterator(size_t count_value);
...@@ -102,7 +102,7 @@ class ObjectPool { ...@@ -102,7 +102,7 @@ class ObjectPool {
private: private:
size_t count_value; size_t count_value;
int ret_value; bool ret_value;
}; };
bool IsContained(const T &obj) const; bool IsContained(const T &obj) const;
......
...@@ -63,8 +63,8 @@ PT_MAIN("Data Structures C++") { ...@@ -63,8 +63,8 @@ PT_MAIN("Data Structures C++") {
embb::containers::LockFreeStack<int> >); embb::containers::LockFreeStack<int> >);
PT_RUN(embb::containers::test::ObjectPoolTest PT_RUN(embb::containers::test::ObjectPoolTest
<embb::containers::LockFreeTreeValuePool<int COMMA 0 > >); <embb::containers::LockFreeTreeValuePool<bool COMMA false > >);
PT_RUN(embb::containers::test::ObjectPoolTest PT_RUN(embb::containers::test::ObjectPoolTest
<embb::containers::WaitFreeArrayValuePool<int COMMA 0> >); <embb::containers::WaitFreeArrayValuePool<bool COMMA false> >);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment