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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
enum JobCode
{
PRINT_MESSAGE_AND_WAIT3SEC,
INCREASE_NUMBER,
PRIORITY_TEST,
WAIT_FOR_BREAK_FLAG,
WAIT_FOR_THREAD_TO_FINISH,
WAIT_FOR_CONDITION,
BOUNCE_CONDITIONS,
TEST_ID,
WAIT2SEC_AND_SIGNALCOND,
HOLD_MUTEX_FOR2SEC,
WAIT_2_SEC,
SILENTNOP,
NOP
};
class Job
{
private:
Job(const Job &);
Job &operator=(const Job&);
public:
JobCode code;
char *message;
FastOS_Mutex *mutex;
FastOS_Cond *condition;
FastOS_BoolCond *boolcondition;
FastOS_ThreadInterface *otherThread, *ownThread;
double *timebuf;
double average;
int result;
FastOS_ThreadId _threadId;
Job *otherjob;
int bouncewakeupcnt;
bool bouncewakeup;
Job()
: code(NOP),
message(nullptr),
mutex(nullptr),
condition(nullptr),
boolcondition(nullptr),
otherThread(nullptr),
ownThread(nullptr),
timebuf(nullptr),
average(0.0),
result(-1),
_threadId(),
otherjob(nullptr),
bouncewakeupcnt(0),
bouncewakeup(false)
{
}
~Job()
{
if(message != nullptr)
free(message);
}
};
|