Skip to content

Commit

Permalink
move TaskSpaceDeleter & ItemControlBlockDeleter definitions to place …
Browse files Browse the repository at this point in the history
…where TaskSpace & ItemControlBlock are complete types
  • Loading branch information
michaelsippel committed Feb 1, 2024
1 parent 3f18e5c commit cb37cf7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions redGrapes/task/task_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

namespace redGrapes
{
void TaskSpaceDeleter::operator()(TaskSpace* s)
{
delete s;
}

TaskSpace::~TaskSpace()
{
}
Expand Down
5 changes: 1 addition & 4 deletions redGrapes/task/task_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ namespace redGrapes

struct TaskSpaceDeleter
{
void operator()(TaskSpace* space)
{
delete space;
}
void operator()(TaskSpace* space);
};

/*! TaskSpace handles sub-taskspaces of child tasks
Expand Down
18 changes: 11 additions & 7 deletions redGrapes/util/atomic_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@ namespace redGrapes

struct ItemControlBlockDeleter
{
void operator()(ItemControlBlock* e)
{
auto alloc = e->alloc;
e->~ItemControlBlock();
memory::Block blk{(uintptr_t) e, sizeof(ItemControlBlock) + sizeof(Item)};
alloc.deallocate(blk);
}
void operator()(ItemControlBlock*);
};

struct ItemControlBlock : Refcounted<ItemControlBlock, ItemControlBlockDeleter>
Expand Down Expand Up @@ -295,6 +289,16 @@ namespace redGrapes
}
};

template<typename Item, typename Allocator>
void AtomicList<Item, Allocator>::ItemControlBlockDeleter::operator()(
AtomicList<Item, Allocator>::ItemControlBlock* e)
{
Allocator alloc = e->alloc;
e->~ItemControlBlock();
memory::Block blk{(uintptr_t) e, 0};
alloc.deallocate(blk);
}

} // namespace memory

} // namespace redGrapes

0 comments on commit cb37cf7

Please sign in to comment.