From 5471fe7bfb0cddf8642f9dba1ba2117a558ffb78 Mon Sep 17 00:00:00 2001
From: j2-tulloch <james2.tulloch@live.uwe.ac.uk>
Date: Fri, 5 Jan 2024 14:48:36 +0000
Subject: [PATCH] Upload New File

---
 Assignment/Task 3/fiber.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Assignment/Task 3/fiber.h

diff --git a/Assignment/Task 3/fiber.h b/Assignment/Task 3/fiber.h
new file mode 100644
index 0000000..7ba4110
--- /dev/null
+++ b/Assignment/Task 3/fiber.h	
@@ -0,0 +1,31 @@
+#ifndef FIBER_H
+#define FIBER_H
+
+#include <array>
+#include "context.h"
+
+class fiber {
+private:
+    Context context_;
+    std::array<char, 4096> stack_;
+    char* stack_bottom_;
+    char* stack_top_;
+    void* data_;
+    bool is_finished;
+
+public:
+    fiber(void (*function)(void*), void* data);
+    ~fiber();
+
+    Context* get_context();
+    void* get_data() const;
+    void yield();
+    void finish() {
+    is_finished = true;
+    }
+    bool finished() const{
+    return is_finished;}
+};
+
+#endif // FIBER_H
+
-- 
GitLab