Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
73ae78e6
Commit
73ae78e6
authored
Feb 07, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Modbus): исправил баг приводивший к deadlock. Заодно перевёл
MBExchange на использование rwmutex.
parent
64cc0668
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
16 deletions
+13
-16
admin.sh
Utilities/Admin/admin.sh
+1
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+5
-7
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+1
-1
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+3
-3
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+1
-1
RTUExchange.cc
extensions/ModbusMaster/RTUExchange.cc
+2
-3
No files found.
Utilities/Admin/admin.sh
View file @
73ae78e6
#!/bin/sh
./uniset
-start.sh
-f
"./uniset
-admin --confile test.xml --
`
basename
$0
.sh
`
$1
$2
$3
$4
"
./uniset
2-start.sh
-f
"./uniset2
-admin --confile test.xml --
`
basename
$0
.sh
`
$1
$2
$3
$4
"
exit
$?
extensions/ModbusMaster/MBExchange.cc
View file @
73ae78e6
...
...
@@ -2463,7 +2463,6 @@ void MBExchange::sysCommand( const UniSetTypes::SystemMessage *sm )
if
(
!
force
)
{
uniset_mutex_lock
l
(
pollMutex
,
2000
);
force
=
true
;
poll
();
force
=
false
;
...
...
@@ -2634,7 +2633,7 @@ void MBExchange::poll()
if
(
!
mb
)
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
pollActivated
=
false
;
mb
=
initMB
(
false
);
if
(
!
mb
)
...
...
@@ -2653,7 +2652,7 @@ void MBExchange::poll()
}
{
uniset_
mutex_
lock
l
(
pollMutex
);
uniset_
rwmutex_wr
lock
l
(
pollMutex
);
pollActivated
=
true
;
ptTimeout
.
reset
();
}
...
...
@@ -2730,7 +2729,7 @@ void MBExchange::poll()
}
{
uniset_
mutex_
lock
l
(
pollMutex
);
uniset_
rwmutex_wr
lock
l
(
pollMutex
);
pollActivated
=
false
;
}
...
...
@@ -2754,7 +2753,6 @@ void MBExchange::poll()
if
(
allNotRespond
&&
ptReopen
.
checkTime
()
)
{
uniset_mutex_lock
l
(
pollMutex
,
300
);
dwarn
<<
myname
<<
": REOPEN timeout..("
<<
ptReopen
.
getInterval
()
<<
")"
<<
endl
;
mb
=
initMB
(
true
);
...
...
@@ -2799,7 +2797,7 @@ void MBExchange::updateRespondSensors()
{
bool
chanTimeout
=
false
;
{
uniset_
mutex_
lock
l
(
pollMutex
);
uniset_
rwmutex_r
lock
l
(
pollMutex
);
chanTimeout
=
pollActivated
&&
ptTimeout
.
checkTime
();
}
...
...
@@ -2840,7 +2838,7 @@ void MBExchange::execute()
askTimer
(
tmExchange
,
0
);
}
catch
(...){}
initMB
(
false
);
while
(
1
)
...
...
extensions/ModbusMaster/MBExchange.h
View file @
73ae78e6
...
...
@@ -232,7 +232,7 @@ class MBExchange:
RTUDeviceMap
rmap
;
InitList
initRegList
;
/*!< список регистров для инициализации */
UniSetTypes
::
uniset_mutex
pollMutex
;
UniSetTypes
::
uniset_
rw
mutex
pollMutex
;
virtual
ModbusClient
*
initMB
(
bool
reopen
=
false
)
=
0
;
...
...
extensions/ModbusMaster/MBTCPMaster.cc
View file @
73ae78e6
...
...
@@ -85,7 +85,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
{
if
(
!
reopen
)
return
mbtcp
;
delete
mbtcp
;
mb
=
0
;
mbtcp
=
0
;
...
...
@@ -95,7 +95,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
{
ost
::
Thread
::
setException
(
ost
::
Thread
::
throwException
);
mbtcp
=
new
ModbusTCPMaster
();
ost
::
InetAddress
ia
(
iaddr
.
c_str
());
mbtcp
->
connect
(
ia
,
port
);
mbtcp
->
setForceDisconnect
(
force_disconnect
);
...
...
@@ -138,7 +138,7 @@ void MBTCPMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
void
MBTCPMaster
::
poll_thread
()
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
ptTimeout
.
reset
();
}
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
73ae78e6
...
...
@@ -273,7 +273,7 @@ void MBTCPMultiMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
void
MBTCPMultiMaster
::
poll_thread
()
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
ptTimeout
.
reset
();
}
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
73ae78e6
...
...
@@ -172,7 +172,7 @@ void RTUExchange::poll()
if
(
!
mb
)
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
pollActivated
=
false
;
mb
=
initMB
(
false
);
if
(
!
mb
)
...
...
@@ -191,7 +191,7 @@ void RTUExchange::poll()
}
{
uniset_
mutex_lock
l
(
pollMutex
,
200
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
pollActivated
=
true
;
ptTimeout
.
reset
();
}
...
...
@@ -305,7 +305,6 @@ void RTUExchange::poll()
if
(
allNotRespond
&&
ptReopen
.
checkTime
()
)
{
uniset_mutex_lock
l
(
pollMutex
,
300
);
dwarn
<<
myname
<<
": REOPEN timeout..("
<<
ptReopen
.
getInterval
()
<<
")"
<<
endl
;
mb
=
initMB
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment