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() {
template< typename GuardType >
bool HazardPointerThreadEntry<GuardType>::IsActive() {
return (is_active == 1);
return is_active;
}
template< typename GuardType >
bool HazardPointerThreadEntry<GuardType>::TryReserve() {
int expected = 0;
return is_active.CompareAndSwap(expected, 1);
bool expected = false;
return is_active.CompareAndSwap(expected, true);
}
template< typename GuardType >
void HazardPointerThreadEntry<GuardType>::Deactivate() {
is_active = 0;
is_active = false;
}
template< typename GuardType >
......@@ -198,10 +198,7 @@ GuardPointer(int guardNumber, GuardType pointerToGuard) {
template< typename GuardType >
void HazardPointerThreadEntry<GuardType>::SetActive(bool active) {
if (active == true)
is_active = 1;
else
is_active = 0;
is_active = active;
}
template< typename GuardType >
......
......@@ -201,7 +201,7 @@ class HazardPointerThreadEntry {
* signal that it is leaving. If a thread has left, the other threads are
* 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.
......
......@@ -99,7 +99,7 @@ GetIndexOfObject(const T &obj) const {
template<class T, typename ValuePool, class ObjectAllocator>
T* ObjectPool<T, ValuePool, ObjectAllocator>::AllocateRaw() {
int val;
bool val;
int allocated_index = p.Allocate(val);
if (allocated_index == -1) {
return NULL;
......@@ -128,7 +128,7 @@ void ObjectPool<T, ValuePool, ObjectAllocator>::Free(T* obj) {
int index = GetIndexOfObject(*obj);
obj->~T();
p.Free(1, index);
p.Free(true, index);
}
template<class T, typename ValuePool, class ObjectAllocator>
......
......@@ -105,7 +105,7 @@ class LockFreeMPMCQueueNode {
* which stores the elements.
*/
template< typename T,
typename ValuePool = embb::containers::LockFreeTreeValuePool < int, 0 >
typename ValuePool = embb::containers::LockFreeTreeValuePool < bool, false >
>
class LockFreeMPMCQueue {
private:
......
......@@ -170,7 +170,7 @@ class LockFreeStackNode {
* which stores the elements.
*/
template< typename T,
typename ValuePool = embb::containers::LockFreeTreeValuePool < int, 0 > >
typename ValuePool = embb::containers::LockFreeTreeValuePool < bool, false > >
class LockFreeStack {
private:
/**
......
......@@ -55,7 +55,7 @@ namespace containers {
*/
template<class T,
typename ValuePool =
embb::containers::WaitFreeArrayValuePool< int, 0 >,
embb::containers::WaitFreeArrayValuePool< bool, false >,
class ObjectAllocator = embb::base::Allocator<T> >
class ObjectPool {
private:
......@@ -87,9 +87,9 @@ class ObjectPool {
class ReturningTrueIterator {
public:
typedef ReturningTrueIterator self_type;
typedef int value_type;
typedef int& reference;
typedef int* pointer;
typedef bool value_type;
typedef bool& reference;
typedef bool* pointer;
typedef std::forward_iterator_tag iterator_category;
typedef int difference_type;
explicit ReturningTrueIterator(size_t count_value);
......@@ -102,7 +102,7 @@ class ObjectPool {
private:
size_t count_value;
int ret_value;
bool ret_value;
};
bool IsContained(const T &obj) const;
......
......@@ -63,8 +63,8 @@ PT_MAIN("Data Structures C++") {
embb::containers::LockFreeStack<int> >);
PT_RUN(embb::containers::test::ObjectPoolTest
<embb::containers::LockFreeTreeValuePool<int COMMA 0 > >);
<embb::containers::LockFreeTreeValuePool<bool COMMA false > >);
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