-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmulti_process.cpp.autosave
113 lines (67 loc) · 1.47 KB
/
multi_process.cpp.autosave
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "mutil_process.h"
#include <QDebug>
static QMutex assembly_line_mutex;
AssemblyLine::AssemblyLine(QDomElement assembly_line)
{
this->assembly_line = assembly_line;
}
void AssemblyLine::run()
{
while(true)
{
switch(this->get_state())
{
case 0:
break;
case 1:
this->do_work();
break;
case 2:
break;
default:
break;
}
}
}
void AssemblyLine::do_work()
{
switch(this->sub_state)
{
case sub_state0:
if(this->count < this->assembly_line.attribute("times").toShort())
{
this->sub_state = sub_state1;
this->process = this->assembly_line.firstChildElement();
}
else
{
this->set_state(0);
}
break;
case sub_state1:
if(this->process.tagName() == "robot")
{
}
break;
default:
break;
}
}
void AssemblyLine::set_state(int state)
{
QMutexLocker m_locker(&this->mutex);
this->assembly_line_state = state;
}
int AssemblyLine::get_state()
{
QMutexLocker m_locker(&this->mutex);
return this->assembly_line_state;
}
void AssemblyLine::acquire()
{
this->share_memory_mutex.lock();
}
void AssemblyLine::release()
{
this->share_memory_mutex.unlock();
}