From 47936e23f96276b38180008085c38405ba746e20 Mon Sep 17 00:00:00 2001 From: Hannes Kuchelmeister Date: Sun, 10 Jan 2021 15:05:30 +0100 Subject: [PATCH] add operations checker --- Assignment_3/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assignment_3/main.cpp b/Assignment_3/main.cpp index 400dd74..69e4734 100644 --- a/Assignment_3/main.cpp +++ b/Assignment_3/main.cpp @@ -2,6 +2,7 @@ #include #include +#include #include using namespace std::chrono; @@ -15,6 +16,7 @@ using namespace std::chrono; #endif #define OP_COUNT 100000 +#define THREADS 4 enum methodname {push, pop, size, noop}; typedef struct _operation{ @@ -78,6 +80,22 @@ void do_operation(operation* op, Stack* set) { // } //} +void run_checker(ADTOperationQueue queue, int* done_count) { + ADTStack * adt_stack = new ADTStack(); + while(true) { + int finished = *done_count; + size_t queue_size = queue.size(); + + if (finished >= THREADS && queue_size == 0) { + break; + } else { + operation op = queue.dequeue(); + adt_stack->do_op(&op); + } + } + std::cout << "Done checking operations" << std::endl; +} + int main(){ return 0; } \ No newline at end of file