diff --git a/redGrapes/task/task_space.cpp b/redGrapes/task/task_space.cpp index 98c49a5f..50d917d7 100644 --- a/redGrapes/task/task_space.cpp +++ b/redGrapes/task/task_space.cpp @@ -16,6 +16,11 @@ namespace redGrapes { +void TaskSpaceDeleter::operator() ( TaskSpace * s ) + { + delete s; + } + TaskSpace::~TaskSpace() { } diff --git a/redGrapes/task/task_space.hpp b/redGrapes/task/task_space.hpp index 1aed1df8..1daa960d 100644 --- a/redGrapes/task/task_space.hpp +++ b/redGrapes/task/task_space.hpp @@ -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 diff --git a/redGrapes/util/atomic_list.hpp b/redGrapes/util/atomic_list.hpp index fa14b6e7..61619285 100644 --- a/redGrapes/util/atomic_list.hpp +++ b/redGrapes/util/atomic_list.hpp @@ -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 > @@ -306,6 +299,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