summaryrefslogtreecommitdiffstats
path: root/04_exercise/arena/arena_list.h
diff options
context:
space:
mode:
authorStefan Zabka <zabkaste@hu-berlin.de>2020-06-22 16:43:42 +0200
committerStefan Zabka <zabkaste@hu-berlin.de>2020-06-22 16:43:42 +0200
commit239f248456ad00f894dc26dceefa968898738c9d (patch)
tree14d41af555b12c88401d8bb46bae9f4319497b62 /04_exercise/arena/arena_list.h
parent021afcb8e4aa4fbc7905f527089c415108c86c75 (diff)
downloadbetriebssysteme-239f248456ad00f894dc26dceefa968898738c9d.tar.gz
betriebssysteme-239f248456ad00f894dc26dceefa968898738c9d.zip
Getting make to run
Diffstat (limited to '04_exercise/arena/arena_list.h')
-rw-r--r--04_exercise/arena/arena_list.h57
1 files changed, 0 insertions, 57 deletions
diff --git a/04_exercise/arena/arena_list.h b/04_exercise/arena/arena_list.h
deleted file mode 100644
index 304209c..0000000
--- a/04_exercise/arena/arena_list.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Created by stefan on 10.06.20.
-//
-
-#ifndef BETRIEBSYSTEME_ARENA_LIST_H
-#define BETRIEBSYSTEME_ARENA_LIST_H
-
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdatomic.h>
-
-typedef struct Node {
- void * value;
- struct Node * next;
- struct Node * prev;
-} Node;
-
-typedef struct List {
- Node * first;
- Node * last;
-} List;
-
-
-// Should we have a free list or just a bit set relative to the size of the slab?
-/** This structure manages an arena / memory slab to be used
- * This structure is thread-safe as it locks internally
- * It will spin until a request is safe to access the items
- * This also means this structure shouldn't be read externally
- * unless the thread doing so managed to aquire the atomic_flag
- */
-typedef struct ArenaList {
- List freeList;
- List activeList;
- Node * arena;
- size_t size;
- atomic_char lock;
-} AtomicArenaList;
-
-typedef bool (*SearchFunction)(void const *);
-//Initializes the node array
-AtomicArenaList alInit(Node * arena, size_t size);
-// Return -1 if the List is full
-int alPush(AtomicArenaList * al, void * value);
-
-// Return -1 if the Node was already deleted
-int alRemoveElem(AtomicArenaList * al, void * value);
-
-/**
- * Searches the activeList for an element
- * for which the search function returns true
- * The function will be passed the value pointer
- * of a given Node
- * @return the Element pointed or NULL if nothing matched
- */
-void *alFindLastElem(AtomicArenaList *al, SearchFunction f);
-
-#endif // BETRIEBSYSTEME_ARENA_LIST_H