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 Dec 13, 2023
1 parent 2745ede commit f44d778
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 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
10 changes: 5 additions & 5 deletions redGrapes/task/task_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace redGrapes
struct Task;

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

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

/*! TaskSpace handles sub-taskspaces of child tasks
*/
struct TaskSpace
Expand Down
21 changes: 12 additions & 9 deletions redGrapes/util/atomic_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,10 @@ template <
>
struct AtomicList
{
struct ItemControlBlock;

struct ItemControlBlock;
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 @@ -278,6 +271,16 @@ struct AtomicList

};


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
Expand Down

0 comments on commit f44d778

Please sign in to comment.