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
813c7189
Commit
813c7189
authored
Feb 07, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Modbus): исправил баг приводивший к deadlock. Заодно перевёл
MBExchange на использование rwmutex.
parent
bae39000
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
13 deletions
+10
-13
admin.sh
Utilities/Admin/admin.sh
+1
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+4
-6
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+1
-1
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+1
-1
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 @
813c7189
#!/bin/sh
#!/bin/sh
./uniset
-start.sh
-f
"./uniset-admin --confile test.xml --
`
basename
$0
.sh
`
$1
$2
$3
$4
$5
"
./uniset
2-start.sh
-f
"./uniset2-admin --confile test.xml --
`
basename
$0
.sh
`
$1
$2
$3
$4
"
exit
$?
exit
$?
extensions/ModbusMaster/MBExchange.cc
View file @
813c7189
...
@@ -2463,7 +2463,6 @@ void MBExchange::sysCommand( const UniSetTypes::SystemMessage *sm )
...
@@ -2463,7 +2463,6 @@ void MBExchange::sysCommand( const UniSetTypes::SystemMessage *sm )
if
(
!
force
)
if
(
!
force
)
{
{
uniset_mutex_lock
l
(
pollMutex
,
2000
);
force
=
true
;
force
=
true
;
poll
();
poll
();
force
=
false
;
force
=
false
;
...
@@ -2634,7 +2633,7 @@ void MBExchange::poll()
...
@@ -2634,7 +2633,7 @@ void MBExchange::poll()
if
(
!
mb
)
if
(
!
mb
)
{
{
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
pollActivated
=
false
;
pollActivated
=
false
;
mb
=
initMB
(
false
);
mb
=
initMB
(
false
);
if
(
!
mb
)
if
(
!
mb
)
...
@@ -2653,7 +2652,7 @@ void MBExchange::poll()
...
@@ -2653,7 +2652,7 @@ void MBExchange::poll()
}
}
{
{
uniset_
mutex_
lock
l
(
pollMutex
);
uniset_
rwmutex_wr
lock
l
(
pollMutex
);
pollActivated
=
true
;
pollActivated
=
true
;
ptTimeout
.
reset
();
ptTimeout
.
reset
();
}
}
...
@@ -2730,7 +2729,7 @@ void MBExchange::poll()
...
@@ -2730,7 +2729,7 @@ void MBExchange::poll()
}
}
{
{
uniset_
mutex_
lock
l
(
pollMutex
);
uniset_
rwmutex_wr
lock
l
(
pollMutex
);
pollActivated
=
false
;
pollActivated
=
false
;
}
}
...
@@ -2754,7 +2753,6 @@ void MBExchange::poll()
...
@@ -2754,7 +2753,6 @@ void MBExchange::poll()
if
(
allNotRespond
&&
ptReopen
.
checkTime
()
)
if
(
allNotRespond
&&
ptReopen
.
checkTime
()
)
{
{
uniset_mutex_lock
l
(
pollMutex
,
300
);
dwarn
<<
myname
<<
": REOPEN timeout..("
<<
ptReopen
.
getInterval
()
<<
")"
<<
endl
;
dwarn
<<
myname
<<
": REOPEN timeout..("
<<
ptReopen
.
getInterval
()
<<
")"
<<
endl
;
mb
=
initMB
(
true
);
mb
=
initMB
(
true
);
...
@@ -2799,7 +2797,7 @@ void MBExchange::updateRespondSensors()
...
@@ -2799,7 +2797,7 @@ void MBExchange::updateRespondSensors()
{
{
bool
chanTimeout
=
false
;
bool
chanTimeout
=
false
;
{
{
uniset_
mutex_
lock
l
(
pollMutex
);
uniset_
rwmutex_r
lock
l
(
pollMutex
);
chanTimeout
=
pollActivated
&&
ptTimeout
.
checkTime
();
chanTimeout
=
pollActivated
&&
ptTimeout
.
checkTime
();
}
}
...
...
extensions/ModbusMaster/MBExchange.h
View file @
813c7189
...
@@ -232,7 +232,7 @@ class MBExchange:
...
@@ -232,7 +232,7 @@ class MBExchange:
RTUDeviceMap
rmap
;
RTUDeviceMap
rmap
;
InitList
initRegList
;
/*!< список регистров для инициализации */
InitList
initRegList
;
/*!< список регистров для инициализации */
UniSetTypes
::
uniset_mutex
pollMutex
;
UniSetTypes
::
uniset_
rw
mutex
pollMutex
;
virtual
ModbusClient
*
initMB
(
bool
reopen
=
false
)
=
0
;
virtual
ModbusClient
*
initMB
(
bool
reopen
=
false
)
=
0
;
...
...
extensions/ModbusMaster/MBTCPMaster.cc
View file @
813c7189
...
@@ -138,7 +138,7 @@ void MBTCPMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
...
@@ -138,7 +138,7 @@ void MBTCPMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
void
MBTCPMaster
::
poll_thread
()
void
MBTCPMaster
::
poll_thread
()
{
{
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
ptTimeout
.
reset
();
ptTimeout
.
reset
();
}
}
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
813c7189
...
@@ -273,7 +273,7 @@ void MBTCPMultiMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
...
@@ -273,7 +273,7 @@ void MBTCPMultiMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
void
MBTCPMultiMaster
::
poll_thread
()
void
MBTCPMultiMaster
::
poll_thread
()
{
{
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
ptTimeout
.
reset
();
ptTimeout
.
reset
();
}
}
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
813c7189
...
@@ -172,7 +172,7 @@ void RTUExchange::poll()
...
@@ -172,7 +172,7 @@ void RTUExchange::poll()
if
(
!
mb
)
if
(
!
mb
)
{
{
{
{
uniset_
mutex_lock
l
(
pollMutex
,
300
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
pollActivated
=
false
;
pollActivated
=
false
;
mb
=
initMB
(
false
);
mb
=
initMB
(
false
);
if
(
!
mb
)
if
(
!
mb
)
...
@@ -191,7 +191,7 @@ void RTUExchange::poll()
...
@@ -191,7 +191,7 @@ void RTUExchange::poll()
}
}
{
{
uniset_
mutex_lock
l
(
pollMutex
,
200
);
uniset_
rwmutex_wrlock
l
(
pollMutex
);
pollActivated
=
true
;
pollActivated
=
true
;
ptTimeout
.
reset
();
ptTimeout
.
reset
();
}
}
...
@@ -305,7 +305,6 @@ void RTUExchange::poll()
...
@@ -305,7 +305,6 @@ void RTUExchange::poll()
if
(
allNotRespond
&&
ptReopen
.
checkTime
()
)
if
(
allNotRespond
&&
ptReopen
.
checkTime
()
)
{
{
uniset_mutex_lock
l
(
pollMutex
,
300
);
dwarn
<<
myname
<<
": REOPEN timeout..("
<<
ptReopen
.
getInterval
()
<<
")"
<<
endl
;
dwarn
<<
myname
<<
": REOPEN timeout..("
<<
ptReopen
.
getInterval
()
<<
")"
<<
endl
;
mb
=
initMB
(
true
);
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