-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConcurrentInstance.hpp
More file actions
39 lines (32 loc) · 843 Bytes
/
ConcurrentInstance.hpp
File metadata and controls
39 lines (32 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// ConcurrentInstance.hpp
// ConcurrentEvaluation
//
// Created by Wai Man Chan on 2/24/16.
// Copyright © 2016 Wai Man Chan. All rights reserved.
//
#ifndef ConcurrentInstance_hpp
#define ConcurrentInstance_hpp
#include <stdio.h>
#include <pthread.h>
struct testFieldContext {
void (*process)(void*ptr, unsigned int threadID, unsigned int loopIndex);
void *objPtr;
unsigned int *counterStack;
bool threadActivate;
unsigned int loop;
};
struct testFieldObject {
testFieldContext *context;
unsigned int index;
};
class ConcurrentTestField {
pthread_t *threads;
testFieldObject *objs;
unsigned int threadCount;
public:
ConcurrentTestField(unsigned int numberOfThread, testFieldContext context);
~ConcurrentTestField();
double start();
};
#endif /* ConcurrentInstance_hpp */