equal
deleted
inserted
replaced
6 |
6 |
7 #include <QMutex> |
7 #include <QMutex> |
8 |
8 |
9 #include <QList> |
9 #include <QList> |
10 |
10 |
11 int HWMap::isBusy(0); // initialize static variable |
|
12 QList<HWMap*> srvsList; |
11 QList<HWMap*> srvsList; |
13 QMutex tcpSrvMut; |
12 QMutex tcpSrvMut; |
14 |
13 |
15 HWMap::HWMap() : |
14 HWMap::HWMap() : |
16 m_isStarted(false) |
15 m_isStarted(false) |
40 //IPCSocket = 0; |
39 //IPCSocket = 0; |
41 IPCServer->close(); |
40 IPCServer->close(); |
42 //deleteLater(); |
41 //deleteLater(); |
43 |
42 |
44 |
43 |
45 tcpSrvMut.lock(); |
|
46 if(isBusy) --isBusy; |
|
47 tcpSrvMut.unlock(); |
|
48 emit ImageReceived(im); |
44 emit ImageReceived(im); |
49 readbuffer.clear(); |
45 readbuffer.clear(); |
|
46 if(srvsList.size()==1) srvsList.pop_front(); |
50 emit isReadyNow(); |
47 emit isReadyNow(); |
51 } |
48 } |
52 |
49 |
53 void HWMap::ClientRead() |
50 void HWMap::ClientRead() |
54 { |
51 { |
98 } |
95 } |
99 |
96 |
100 void HWMap::Start() |
97 void HWMap::Start() |
101 { |
98 { |
102 tcpSrvMut.lock(); |
99 tcpSrvMut.lock(); |
103 if(!isBusy) { |
100 if(srvsList.isEmpty()) { |
104 ++isBusy; |
|
105 srvsList.push_back(this); |
101 srvsList.push_back(this); |
106 tcpSrvMut.unlock(); |
102 tcpSrvMut.unlock(); |
107 } else { |
103 } else { |
108 connect(srvsList.back(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
104 connect(srvsList.back(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
109 srvsList.push_back(this); |
105 srvsList.push_back(this); |
110 //deleteLater(); |
|
111 tcpSrvMut.unlock(); |
106 tcpSrvMut.unlock(); |
112 return; |
107 return; |
113 } |
108 } |
114 |
109 |
115 RealStart(); |
110 RealStart(); |