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
7e0f414b
Commit
7e0f414b
authored
Sep 09, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SmemoryPlus): Решение проблеммы с "FATAL: exception not rethrown".
Заодно немного переформатировал код.
parent
46ebb465
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
133 additions
and
13 deletions
+133
-13
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+17
-1
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+46
-2
MBTCPMaster.h
extensions/ModbusMaster/MBTCPMaster.h
+1
-0
main.cc
extensions/ModbusMaster/main.cc
+3
-0
mtr-conv.cc
extensions/ModbusMaster/mtr-conv.cc
+0
-0
mtr-read.cc
extensions/ModbusMaster/mtr-read.cc
+0
-0
start_fg_mbtcp.sh
extensions/ModbusMaster/start_fg_mbtcp.sh
+1
-1
vtconv.cc
extensions/ModbusMaster/vtconv.cc
+0
-0
smemory-plus.cc
extensions/SharedMemoryPlus/smemory-plus.cc
+11
-2
Extensions.h
extensions/include/Extensions.h
+0
-0
UObject_SK.h
extensions/include/UObject_SK.h
+0
-0
LogAgregator.h
include/LogAgregator.h
+0
-0
ThreadCreator.h
include/ThreadCreator.h
+1
-2
DebugStream.cc
src/Log/DebugStream.cc
+0
-0
LogAgregator.cc
src/Log/LogAgregator.cc
+0
-0
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+10
-2
UniSetManager.cc
src/ObjectRepository/UniSetManager.cc
+22
-0
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+21
-3
IOController.cc
src/Processes/IOController.cc
+0
-0
NCRestorer.cc
src/Processes/NCRestorer.cc
+0
-0
Configuration.cc
src/Various/Configuration.cc
+0
-0
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
7e0f414b
...
@@ -165,13 +165,19 @@ MBExchange::~MBExchange()
...
@@ -165,13 +165,19 @@ MBExchange::~MBExchange()
{
{
if
(
it1
->
second
->
rtu
)
if
(
it1
->
second
->
rtu
)
{
{
try
{
delete
it1
->
second
->
rtu
;
delete
it1
->
second
->
rtu
;
it1
->
second
->
rtu
=
0
;
it1
->
second
->
rtu
=
0
;
}
catch
(...){}
}
}
RTUDevice
*
d
(
it1
->
second
);
RTUDevice
*
d
(
it1
->
second
);
for
(
auto
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
for
(
auto
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
{
try
{
delete
it
->
second
;
delete
it
->
second
;
}
catch
(...){}
}
delete
it1
->
second
;
delete
it1
->
second
;
}
}
...
@@ -193,6 +199,7 @@ void MBExchange::waitSMReady()
...
@@ -193,6 +199,7 @@ void MBExchange::waitSMReady()
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
"(waitSMReady): failed waiting SharedMemory "
<<
ready_timeout
<<
" msec"
;
err
<<
myname
<<
"(waitSMReady): failed waiting SharedMemory "
<<
ready_timeout
<<
" msec"
;
dcrit
<<
err
.
str
()
<<
endl
;
dcrit
<<
err
.
str
()
<<
endl
;
if
(
checkProcActive
()
)
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
}
}
...
@@ -233,7 +240,15 @@ void MBExchange::sigterm( int signo )
...
@@ -233,7 +240,15 @@ void MBExchange::sigterm( int signo )
{
{
dwarn
<<
myname
<<
": ********* SIGTERM("
<<
signo
<<
") ********"
<<
endl
;
dwarn
<<
myname
<<
": ********* SIGTERM("
<<
signo
<<
") ********"
<<
endl
;
setProcActive
(
false
);
setProcActive
(
false
);
try
{
UniSetObject_LT
::
sigterm
(
signo
);
UniSetObject_LT
::
sigterm
(
signo
);
}
catch
(
...
)
{
// std::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
MBExchange
::
readConfiguration
()
void
MBExchange
::
readConfiguration
()
...
@@ -2580,7 +2595,8 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -2580,7 +2595,8 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
dcrit
<<
err
.
str
()
<<
endl
;
dcrit
<<
err
.
str
()
<<
endl
;
kill
(
SIGTERM
,
getpid
());
// прерываем (перезапускаем) процесс...
kill
(
SIGTERM
,
getpid
());
// прерываем (перезапускаем) процесс...
throw
SystemError
(
err
.
str
());
// throw SystemError(err.str());
return
;
}
}
try
try
...
...
extensions/ModbusMaster/MBTCPMaster.cc
View file @
7e0f414b
...
@@ -75,6 +75,12 @@ pollThread(0)
...
@@ -75,6 +75,12 @@ pollThread(0)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
MBTCPMaster
::~
MBTCPMaster
()
MBTCPMaster
::~
MBTCPMaster
()
{
{
if
(
pollThread
)
{
pollThread
->
stop
();
if
(
pollThread
->
isRunning
()
)
pollThread
->
join
();
}
delete
pollThread
;
delete
pollThread
;
//delete mbtcp;
//delete mbtcp;
}
}
...
@@ -146,12 +152,20 @@ void MBTCPMaster::poll_thread()
...
@@ -146,12 +152,20 @@ void MBTCPMaster::poll_thread()
if
(
sidExchangeMode
!=
DefaultObjectId
&&
force
)
if
(
sidExchangeMode
!=
DefaultObjectId
&&
force
)
exchangeMode
=
shm
->
localGetValue
(
itExchangeMode
,
sidExchangeMode
);
exchangeMode
=
shm
->
localGetValue
(
itExchangeMode
,
sidExchangeMode
);
}
}
catch
(...){}
catch
(...)
{
throw
;
}
try
try
{
{
poll
();
poll
();
}
}
catch
(...){}
catch
(...)
{
// if( !checkProcActive() )
throw
;
}
if
(
!
checkProcActive
()
)
if
(
!
checkProcActive
()
)
break
;
break
;
...
@@ -160,6 +174,36 @@ void MBTCPMaster::poll_thread()
...
@@ -160,6 +174,36 @@ void MBTCPMaster::poll_thread()
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
MBTCPMaster
::
sigterm
(
int
signo
)
{
setProcActive
(
false
);
if
(
pollThread
)
{
pollThread
->
stop
();
if
(
pollThread
->
isRunning
()
)
pollThread
->
join
();
delete
pollThread
;
pollThread
=
0
;
}
try
{
MBExchange
::
sigterm
(
signo
);
}
catch
(
const
std
::
exception
&
ex
)
{
cerr
<<
"catch: "
<<
ex
.
what
()
<<
endl
;
}
catch
(
...
)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
clog
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
}
}
// -----------------------------------------------------------------------------
void
MBTCPMaster
::
help_print
(
int
argc
,
const
char
*
const
*
argv
)
void
MBTCPMaster
::
help_print
(
int
argc
,
const
char
*
const
*
argv
)
{
{
cout
<<
"Default: prefix='mbtcp'"
<<
endl
;
cout
<<
"Default: prefix='mbtcp'"
<<
endl
;
...
...
extensions/ModbusMaster/MBTCPMaster.h
View file @
7e0f414b
...
@@ -208,6 +208,7 @@ class MBTCPMaster:
...
@@ -208,6 +208,7 @@ class MBTCPMaster:
protected
:
protected
:
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
override
;
virtual
std
::
shared_ptr
<
ModbusClient
>
initMB
(
bool
reopen
=
false
)
override
;
virtual
std
::
shared_ptr
<
ModbusClient
>
initMB
(
bool
reopen
=
false
)
override
;
virtual
void
sigterm
(
int
signo
)
override
;
UniSetTypes
::
uniset_rwmutex
mbMutex
;
UniSetTypes
::
uniset_rwmutex
mbMutex
;
std
::
string
iaddr
;
std
::
string
iaddr
;
...
...
extensions/ModbusMaster/main.cc
View file @
7e0f414b
...
@@ -78,6 +78,9 @@ int main( int argc, const char** argv )
...
@@ -78,6 +78,9 @@ int main( int argc, const char** argv )
}
}
catch
(...)
catch
(...)
{
{
std
::
exception_ptr
p
=
std
::
current_exception
();
std
::
clog
<<
(
p
?
p
.
__cxa_exception_type
()
->
name
()
:
"null"
)
<<
std
::
endl
;
dcrit
<<
"(mbtcpmaster): catch ..."
<<
std
::
endl
;
dcrit
<<
"(mbtcpmaster): catch ..."
<<
std
::
endl
;
}
}
...
...
extensions/ModbusMaster/mtr-conv.cc
View file @
7e0f414b
extensions/ModbusMaster/mtr-read.cc
View file @
7e0f414b
extensions/ModbusMaster/start_fg_mbtcp.sh
View file @
7e0f414b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
--confile
test.xml
\
--confile
test.xml
\
--mbtcp-name
MBMaster1
\
--mbtcp-name
MBMaster1
\
--smemory-id
SharedMemory
\
--smemory-id
SharedMemory
\
--dlog-add-levels
info,crit,warn,level4,level3
\
--dlog-add-levels
system,
info,crit,warn,level4,level3
\
--mbtcp-set-prop-prefix
\
--mbtcp-set-prop-prefix
\
--mbtcp-filter-field
rs
\
--mbtcp-filter-field
rs
\
--mbtcp-filter-value
5
\
--mbtcp-filter-value
5
\
...
...
extensions/ModbusMaster/vtconv.cc
View file @
7e0f414b
extensions/SharedMemoryPlus/smemory-plus.cc
View file @
7e0f414b
...
@@ -36,13 +36,23 @@ void activator_terminate( int signo )
...
@@ -36,13 +36,23 @@ void activator_terminate( int signo )
{
{
if
(
logserver
)
if
(
logserver
)
{
{
try
{
delete
logserver
;
delete
logserver
;
logserver
=
0
;
logserver
=
0
;
}
}
catch
(...){}
}
#ifdef UNISET_IO_ENABLE
#ifdef UNISET_IO_ENABLE
for
(
auto
&
i
:
lst_iothr
)
for
(
auto
&
i
:
lst_iothr
)
{
try
{
i
->
stop
();
i
->
stop
();
}
catch
(...){}
}
#endif
#endif
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -211,14 +221,13 @@ int main( int argc, const char **argv )
...
@@ -211,14 +221,13 @@ int main( int argc, const char **argv )
la
.
add
(
ulog
);
la
.
add
(
ulog
);
la
.
add
(
dlog
);
la
.
add
(
dlog
);
#if 0
logserver
=
run_logserver
(
"smplus"
,
la
);
logserver
=
run_logserver
(
"smplus"
,
la
);
if
(
logserver
==
0
)
if
(
logserver
==
0
)
{
{
cerr
<<
"(smemory-plus): run logserver for 'smplus' FAILED"
<<
endl
;
cerr
<<
"(smemory-plus): run logserver for 'smplus' FAILED"
<<
endl
;
return
1
;
return
1
;
}
}
#endif
act
->
run
(
false
);
act
->
run
(
false
);
on_sigchild
(
SIGTERM
);
on_sigchild
(
SIGTERM
);
...
...
extensions/include/Extensions.h
View file @
7e0f414b
extensions/include/UObject_SK.h
View file @
7e0f414b
include/LogAgregator.h
View file @
7e0f414b
include/ThreadCreator.h
View file @
7e0f414b
...
@@ -177,9 +177,8 @@ template <class ThreadMaster>
...
@@ -177,9 +177,8 @@ template <class ThreadMaster>
void
ThreadCreator
<
ThreadMaster
>::
run
()
void
ThreadCreator
<
ThreadMaster
>::
run
()
{
{
pid
=
getpid
();
pid
=
getpid
();
if
(
m
)
if
(
m
)
(
m
->*
act
)();
(
m
->*
act
)();
// PosixThread::stop()
}
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
template
<
class
ThreadMaster
>
template
<
class
ThreadMaster
>
...
...
src/Log/DebugStream.cc
View file @
7e0f414b
src/Log/LogAgregator.cc
View file @
7e0f414b
src/ObjectRepository/UniSetActivator.cc
View file @
7e0f414b
...
@@ -191,8 +191,6 @@ void UniSetActivator::oaDestroy(int signo)
...
@@ -191,8 +191,6 @@ void UniSetActivator::oaDestroy(int signo)
try
try
{
{
stop
();
stop
();
}
}
catch
(...){}
catch
(...){}
...
@@ -210,6 +208,8 @@ void UniSetActivator::oaDestroy(int signo)
...
@@ -210,6 +208,8 @@ void UniSetActivator::oaDestroy(int signo)
ulogsys
<<
myname
<<
"(oaDestroy): orbthr="
<<
orbthr
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orbthr="
<<
orbthr
<<
endl
;
if
(
orbthr
)
if
(
orbthr
)
{
{
try
{
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop... "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop... "
<<
endl
;
orbthr
->
stop
();
orbthr
->
stop
();
...
@@ -218,6 +218,8 @@ void UniSetActivator::oaDestroy(int signo)
...
@@ -218,6 +218,8 @@ void UniSetActivator::oaDestroy(int signo)
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop ok. "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop ok. "
<<
endl
;
}
}
catch
(...){}
}
try
try
{
{
...
@@ -520,6 +522,9 @@ void UniSetActivator::normalexit()
...
@@ -520,6 +522,9 @@ void UniSetActivator::normalexit()
{
{
if
(
gActivator
)
if
(
gActivator
)
ulogsys
<<
gActivator
->
getName
()
<<
"(default exit): good bye."
<<
endl
<<
flush
;
ulogsys
<<
gActivator
->
getName
()
<<
"(default exit): good bye."
<<
endl
<<
flush
;
// std::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
void
UniSetActivator
::
normalterminate
()
void
UniSetActivator
::
normalterminate
()
...
@@ -527,6 +532,9 @@ void UniSetActivator::normalterminate()
...
@@ -527,6 +532,9 @@ void UniSetActivator::normalterminate()
if
(
gActivator
)
if
(
gActivator
)
ucrit
<<
gActivator
->
getName
()
<<
"(default exception terminate): Никто не выловил исключение!!! Good bye."
<<
endl
<<
flush
;
ucrit
<<
gActivator
->
getName
()
<<
"(default exception terminate): Никто не выловил исключение!!! Good bye."
<<
endl
<<
flush
;
// abort();
// abort();
// std::exception_ptr p = std::current_exception();
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetActivator
::
term
(
int
signo
)
void
UniSetActivator
::
term
(
int
signo
)
...
...
src/ObjectRepository/UniSetManager.cc
View file @
7e0f414b
...
@@ -120,10 +120,22 @@ UniSetManager::~UniSetManager()
...
@@ -120,10 +120,22 @@ UniSetManager::~UniSetManager()
catch
(...){}
catch
(...){}
for
(
auto
&
i
:
olist
)
for
(
auto
&
i
:
olist
)
{
try
{
delete
i
;
delete
i
;
}
catch
(...){}
}
for
(
auto
&
i
:
mlist
)
for
(
auto
&
i
:
mlist
)
{
try
{
delete
i
;
delete
i
;
}
catch
(...){}
}
olist
.
clear
();
olist
.
clear
();
mlist
.
clear
();
mlist
.
clear
();
...
@@ -357,8 +369,18 @@ bool UniSetManager::deactivateObject()
...
@@ -357,8 +369,18 @@ bool UniSetManager::deactivateObject()
void
UniSetManager
::
sigterm
(
int
signo
)
void
UniSetManager
::
sigterm
(
int
signo
)
{
{
sig
=
signo
;
sig
=
signo
;
try
{
objects
(
term
);
objects
(
term
);
}
catch
(...){}
try
{
managers
(
term
);
managers
(
term
);
}
catch
(...){}
UniSetObject
::
sigterm
(
signo
);
UniSetObject
::
sigterm
(
signo
);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
...
src/ObjectRepository/UniSetObject.cc
View file @
7e0f414b
...
@@ -134,16 +134,27 @@ stCountOfQueueFull(0)
...
@@ -134,16 +134,27 @@ stCountOfQueueFull(0)
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
UniSetObject
::~
UniSetObject
()
UniSetObject
::~
UniSetObject
()
{
{
try
{
deactivate
();
deactivate
();
}
catch
(...){}
try
{
tmr
->
terminate
();
tmr
->
terminate
();
}
catch
(...){}
if
(
thr
)
if
(
thr
)
{
{
try
{
thr
->
stop
();
thr
->
stop
();
if
(
thr
->
isRunning
()
)
if
(
thr
->
isRunning
()
)
thr
->
join
();
thr
->
join
();
}
catch
(...){}
delete
thr
;
delete
thr
;
}
}
...
@@ -817,10 +828,17 @@ void UniSetObject::processingMessage( UniSetTypes::VoidMessage *msg )
...
@@ -817,10 +828,17 @@ void UniSetObject::processingMessage( UniSetTypes::VoidMessage *msg )
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
}
}
catch
(...)
catch
(
const
std
::
exception
&
ex
)
{
ucrit
<<
myname
<<
"(processingMessage): "
<<
ex
.
what
()
<<
endl
;
}
/*
catch( ... )
{
{
ucrit
<<
myname
<<
"(processingMessage): catch..."
<<
endl
;
std::exception_ptr p = std::current_exception();
ucrit <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
*/
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
...
src/Processes/IOController.cc
View file @
7e0f414b
src/Processes/NCRestorer.cc
View file @
7e0f414b
src/Various/Configuration.cc
View file @
7e0f414b
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