mirror of
https://github.com/13hannes11/UU_la_parallel_programming_practical_assignments.git
synced 2024-09-04 00:50:58 +02:00
add operations checker
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lib/ADT_Stack.h>
|
||||
#include <lib/Stack.cpp>
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user