From 7db9e585cd9481d0f268df43841f89fe2e363885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Tomic=CC=8Cevic=CC=81?= <dominik.tomicevic@gmail.com> Date: Fri, 31 Jul 2015 12:33:12 +0200 Subject: [PATCH] refactored memory engine --- memory/memory_engine.hpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/memory/memory_engine.hpp b/memory/memory_engine.hpp index df76ed7d3..7735f726b 100644 --- a/memory/memory_engine.hpp +++ b/memory/memory_engine.hpp @@ -13,16 +13,8 @@ // make this class non-dependent on the memory allocation strategy // TODO implement real recycling of vertices and edges to improve performance - -template <class id_t, - class lock_t, class MemoryEngine { - template <class T> - using record_t = Record<T, id_t, lock_t>; - - using vertex_t = Vertex<id_t, lock_t>; - using edge_t = Edge<id_t, lock_t>; public: template <class T, @@ -39,29 +31,29 @@ public: } template <class T> - void recycle(record_t<T>* record) + void recycle(Record<T>* record) { recycle(&record->derived()); } - void recycle(vertex_t v) + void recycle(Vertex* v) { delete v; } - void recycle(edge_t e) + void recycle(Edge* e) { delete e; } private: - std::unique_lock<lock_t> acquire() + std::unique_lock<SpinLock> acquire() { - return std::unique_lock<lock_t>(lock); + return std::unique_lock<SpinLock>(lock); } - lock_t lock; + SpinLock lock; }; #endif