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
e12b4c58
Commit
e12b4c58
authored
Jan 13, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UniSetActivator): Переделал механизм завершения процессов. Чтбоы не было "SIGSEGV"
parent
055a718a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
115 deletions
+157
-115
OmniThreadCreator.h
include/OmniThreadCreator.h
+13
-8
UniSetActivator.h
include/UniSetActivator.h
+3
-2
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+141
-105
No files found.
include/OmniThreadCreator.h
View file @
e12b4c58
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#define OmniThreadCreator_h_
#define OmniThreadCreator_h_
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <omnithread.h>
#include <omnithread.h>
#include <memory>
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
/*! \class OmniThreadCreator
/*! \class OmniThreadCreator
* \par
* \par
...
@@ -94,16 +95,20 @@ class OmniThreadCreator:
...
@@ -94,16 +95,20 @@ class OmniThreadCreator:
public
:
public
:
/*! прототип функции вызова */
/*! прототип функции вызова */
typedef
void
(
ThreadMaster
::*
Action
)(
void
*
);
typedef
void
(
ThreadMaster
::*
Action
)();
OmniThreadCreator
(
ThreadMaster
*
m
,
Action
a
,
bool
undetached
=
false
);
OmniThreadCreator
(
const
std
::
shared_ptr
<
ThreadMaster
>&
m
,
Action
a
,
bool
undetached
=
false
);
~
OmniThreadCreator
(){};
~
OmniThreadCreator
(){}
inline
bool
isRunning
(){
return
state
()
==
omni_thread
::
STATE_RUNNING
;
}
inline
void
stop
(){
exit
(
0
);
}
inline
pid_t
getTID
(){
return
id
();
}
protected
:
protected
:
void
*
run_undetached
(
void
*
x
)
void
*
run_undetached
(
void
*
x
)
{
{
if
(
m
)
if
(
m
)
(
m
->*
act
)(
x
);
(
m
.
get
()
->*
act
)(
);
return
(
void
*
)
0
;
return
(
void
*
)
0
;
}
}
...
@@ -111,20 +116,20 @@ class OmniThreadCreator:
...
@@ -111,20 +116,20 @@ class OmniThreadCreator:
virtual
void
run
(
void
*
arg
)
virtual
void
run
(
void
*
arg
)
{
{
if
(
m
)
if
(
m
)
(
m
->*
act
)(
arg
);
(
m
.
get
()
->*
act
)(
);
}
}
private
:
private
:
OmniThreadCreator
();
OmniThreadCreator
();
ThreadMaster
*
m
;
std
::
shared_ptr
<
ThreadMaster
>
m
;
Action
act
;
Action
act
;
};
};
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
template
<
class
ThreadMaster
>
template
<
class
ThreadMaster
>
OmniThreadCreator
<
ThreadMaster
>::
OmniThreadCreator
(
ThreadMaster
*
m
,
Action
a
,
bool
undetach
)
:
OmniThreadCreator
<
ThreadMaster
>::
OmniThreadCreator
(
const
std
::
shared_ptr
<
ThreadMaster
>&
_
m
,
Action
a
,
bool
undetach
)
:
omni_thread
(),
omni_thread
(),
m
(
m
),
m
(
_
m
),
act
(
a
)
act
(
a
)
{
{
if
(
undetach
)
if
(
undetach
)
...
...
include/UniSetActivator.h
View file @
e12b4c58
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include "UniSetTypes.h"
#include "UniSetTypes.h"
#include "UniSetObject.h"
#include "UniSetObject.h"
#include "UniSetManager.h"
#include "UniSetManager.h"
#include "ThreadCreator.h"
#include "
Omni
ThreadCreator.h"
//#include "OmniThreadCreator.h"
//#include "OmniThreadCreator.h"
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
...
@@ -122,10 +122,11 @@ class UniSetActivator:
...
@@ -122,10 +122,11 @@ class UniSetActivator:
void
term
(
int
signo
);
void
term
(
int
signo
);
void
init
();
void
init
();
std
::
shared_ptr
<
ThreadCreator
<
UniSetActivator
>
>
orbthr
;
std
::
shared_ptr
<
Omni
ThreadCreator
<
UniSetActivator
>
>
orbthr
;
CORBA
::
ORB_var
orb
;
CORBA
::
ORB_var
orb
;
TerminateEvent_Signal
s_term
;
TerminateEvent_Signal
s_term
;
ost
::
AtomicCounter
orbthrIsFinished
;
bool
omDestroy
;
bool
omDestroy
;
bool
sig
;
bool
sig
;
...
...
src/ObjectRepository/UniSetActivator.cc
View file @
e12b4c58
...
@@ -54,26 +54,13 @@ using namespace std;
...
@@ -54,26 +54,13 @@ using namespace std;
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
/*! замок для блокирования совместного доступа к функции обрабтки сигналов */
/*! замок для блокирования совместного доступа к функции обрабтки сигналов */
static
UniSetTypes
::
uniset_rwmutex
signalMutex
(
"Activator::signalMutex"
);
static
UniSetTypes
::
uniset_rwmutex
signalMutex
(
"Activator::signalMutex"
);
// static UniSetTypes::uniset_mutex waittermMutex("Activator::waittermMutex");
/*! замок для блокирования совместного к списку получателей сигналов */
//UniSetTypes::uniset_mutex sigListMutex("Activator::sigListMutex");
//static omni_mutex pmutex;
//static omni_condition pcondx(&pmutex);
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
static
std
::
shared_ptr
<
UniSetActivator
>
gActivator
;
static
std
::
shared_ptr
<
UniSetActivator
>
gActivator
;
//static omni_mutex termutex;
static
int
SIGNO
=
0
;
//static omni_condition termcond(&termutex);
static
int
MYPID
=
0
;
//static ThreadCreator<UniSetActivator>* termthread=0;
static
int
SIGNO
;
static
int
MYPID
;
static
const
int
TERMINATE_TIMEOUT
=
10
;
// время отведенное на завершение процесса [сек]
static
const
int
TERMINATE_TIMEOUT
=
10
;
// время отведенное на завершение процесса [сек]
ost
::
AtomicCounter
procterm
=
0
;
ost
::
AtomicCounter
procterm
=
0
;
ost
::
AtomicCounter
doneterm
=
0
;
ost
::
AtomicCounter
doneterm
=
0
;
// PassiveTimer termtmr;
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
UniSetActivatorPtr
UniSetActivator
::
inst
;
UniSetActivatorPtr
UniSetActivator
::
inst
;
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
...
@@ -89,27 +76,25 @@ UniSetActivatorPtr UniSetActivator::Instance( const UniSetTypes::ObjectId id )
...
@@ -89,27 +76,25 @@ UniSetActivatorPtr UniSetActivator::Instance( const UniSetTypes::ObjectId id )
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
void
UniSetActivator
::
Destroy
()
void
UniSetActivator
::
Destroy
()
{
{
inst
.
reset
();
inst
.
reset
();
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
UniSetActivator
::
UniSetActivator
(
const
ObjectId
id
)
:
UniSetActivator
::
UniSetActivator
(
const
ObjectId
id
)
:
UniSetManager
(
id
),
UniSetManager
(
id
),
omDestroy
(
false
),
omDestroy
(
false
),
sig
(
false
)
sig
(
false
)
{
{
UniSetActivator
::
init
();
UniSetActivator
::
init
();
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
UniSetActivator
::
UniSetActivator
()
:
UniSetActivator
::
UniSetActivator
()
:
UniSetManager
(
UniSetTypes
::
DefaultObjectId
),
UniSetManager
(
UniSetTypes
::
DefaultObjectId
),
omDestroy
(
false
),
omDestroy
(
false
),
sig
(
false
)
sig
(
false
)
{
{
// thread(false); // отключаем поток (раз не задан id)
// thread(false); // отключаем поток (раз не задан id)
UniSetActivator
::
init
();
UniSetActivator
::
init
();
}
}
...
@@ -138,14 +123,6 @@ void UniSetActivator::init()
...
@@ -138,14 +123,6 @@ void UniSetActivator::init()
UniSetActivator
::~
UniSetActivator
()
UniSetActivator
::~
UniSetActivator
()
{
{
if
(
orbthr
)
{
orbthr
->
stop
();
if
(
orbthr
->
isRunning
()
)
orbthr
->
join
();
orbthr
.
reset
();
}
if
(
!
procterm
)
if
(
!
procterm
)
{
{
...
@@ -159,24 +136,56 @@ UniSetActivator::~UniSetActivator()
...
@@ -159,24 +136,56 @@ UniSetActivator::~UniSetActivator()
gActivator
.
reset
();
gActivator
.
reset
();
}
}
#if 0
#if 1
if
(
orbthr
)
{
try
{
if
(
orbthr
->
isRunning
()
)
{
orbthr
->
stop
();
orbthr
->
join
(
0
);
}
}
catch
(
omniORB
::
fatalException
&
fe
)
{
ucrit
<<
myname
<<
"(oaDestroy): : поймали omniORB::fatalException:"
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): file: "
<<
fe
.
file
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
catch
(
std
::
exception
&
ex
)
{
ucrit
<<
myname
<<
"(destructor): "
<<
ex
.
what
()
<<
endl
;
}
try
try
{
{
ulogsys
<<
myname
<<
"(destructor): orb destroy... "
<<
endl
;
if
(
!
CORBA
::
is_nil
(
orb
)
)
if
(
!
CORBA
::
is_nil
(
orb
)
)
{
ulogsys << myname << "(oaDestroy): orb destroy... " << endl;
orb
->
destroy
();
orb
->
destroy
();
ulogsys << myname << "(oaDestroy): orb destroy ok."<< endl;
ulogsys
<<
myname
<<
"(destructor): orb destroy ok."
<<
endl
;
}
catch
(
omniORB
::
fatalException
&
fe
)
{
ucrit
<<
myname
<<
"(oaDestroy): : поймали omniORB::fatalException:"
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): file: "
<<
fe
.
file
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
catch
(
std
::
exception
&
ex
)
{
ucrit
<<
myname
<<
"(destructor): "
<<
ex
.
what
()
<<
endl
;
}
}
}
}
catch(...){}
#endif
#endif
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetActivator
::
oaDestroy
(
int
signo
)
void
UniSetActivator
::
oaDestroy
(
int
signo
)
{
{
// waittermMutex.lock();
// waittermMutex.lock();
if
(
!
omDestroy
)
if
(
!
omDestroy
)
{
{
omDestroy
=
true
;
omDestroy
=
true
;
...
@@ -192,51 +201,73 @@ void UniSetActivator::oaDestroy(int signo)
...
@@ -192,51 +201,73 @@ void UniSetActivator::oaDestroy(int signo)
}
}
catch
(...){}
catch
(...){}
try
{
deactivateObject
();
}
catch
(...){}
ulogsys
<<
myname
<<
"(oaDestroy): pman deactivate... "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): pman deactivate... "
<<
endl
;
pman
->
deactivate
(
false
,
true
);
pman
->
deactivate
(
false
,
true
);
ulogsys
<<
myname
<<
"(oaDestroy): pman deactivate ok. "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): pman deactivate ok. "
<<
endl
;
if
(
orbthrIsFinished
==
0
&&
orbthr
)
{
try
{
ulogsys
<<
myname
<<
"(stop):: shutdown orb... "
<<
endl
;
if
(
orbthr
->
isRunning
()
)
orb
->
shutdown
(
false
);
ulogsys
<<
myname
<<
"(stop): shutdown ok."
<<
endl
;
if
(
orbthr
)
orbthr
->
join
(
0
);
}
catch
(
omniORB
::
fatalException
&
fe
)
{
ucrit
<<
myname
<<
"(oaDestroy): : поймали omniORB::fatalException:"
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): file: "
<<
fe
.
file
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
catch
(...)
{
{
ulogsys
<<
myname
<<
"(oaDestroy): orb shutdown: catch... "
<<
endl
;
}
ulogsys
<<
myname
<<
"(stop): shutdown ok."
<<
endl
;
#if 1
try
try
{
{
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop... "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop... "
<<
endl
;
orbthr
->
stop
();
orbthr
->
stop
();
if
(
orbthr
->
isRunning
()
)
if
(
orbthr
->
isRunning
()
)
orbthr
->
join
(
);
orbthr
->
join
(
0
);
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop ok. "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy): orb thread stop ok. "
<<
endl
;
orbthr
.
reset
();
}
}
catch
(...){}
catch
(
omniORB
::
fatalException
&
fe
)
{
ucrit
<<
myname
<<
"(oaDestroy): : поймали omniORB::fatalException:"
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): file: "
<<
fe
.
file
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
#endif
}
}
else
{
try
try
{
{
ulogsys
<<
myname
<<
"(stop):: shutdown orb... "
<<
endl
;
ulogsys
<<
myname
<<
"(oaDestroy):: shutdown orb... "
<<
endl
;
orb
->
shutdown
(
false
);
orb
->
shutdown
(
true
);
}
catch
(...){}
ulogsys
<<
myname
<<
"(stop): shutdown ok."
<<
endl
;
ulogsys
<<
myname
<<
"(stop): shutdown ok."
<<
endl
;
#if 0
}
try
catch
(
omniORB
::
fatalException
&
fe
)
{
if( !CORBA::is_nil(orb) )
{
{
ulogsys << myname << "(oaDestroy): orb destroy... " << endl;
ucrit
<<
myname
<<
"(oaDestroy): : поймали omniORB::fatalException:"
<<
endl
;
orb->destroy();
ucrit
<<
myname
<<
"(oaDestroy): file: "
<<
fe
.
file
()
<<
endl
;
ulogsys << myname << "(oaDestroy): orb destroy ok."<< endl;
ucrit
<<
myname
<<
"(oaDestroy): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(oaDestroy): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
}
}
}
catch(...){}
#endif
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -269,18 +300,16 @@ void UniSetActivator::run( bool thread )
...
@@ -269,18 +300,16 @@ void UniSetActivator::run( bool thread )
if
(
thread
)
if
(
thread
)
{
{
uinfo
<<
myname
<<
"(run): запускаемся с созданием отдельного потока... "
<<
endl
;
uinfo
<<
myname
<<
"(run): запускаемся с созданием отдельного потока... "
<<
endl
;
orbthr
=
make_shared
<
ThreadCreator
<
UniSetActivator
>
>
(
this
,
&
UniSetActivator
::
work
);
orbthr
=
make_shared
<
OmniThreadCreator
<
UniSetActivator
>
>
(
get_aptr
(),
&
UniSetActivator
::
work
);
int
ret
=
orbthr
->
start
();
orbthrIsFinished
=
0
;
if
(
ret
!=
0
)
orbthr
->
start
();
{
orbthr
->
yield
();
ucrit
<<
myname
<<
"(run): НЕ СМОГЛИ СОЗДАТЬ ORB-поток"
<<
endl
;
throw
SystemError
(
"(UniSetActivator::run): CREATE ORB THREAD FAILED"
);
}
}
}
else
else
{
{
uinfo
<<
myname
<<
"(run): запускаемся без создания отдельного потока... "
<<
endl
;
uinfo
<<
myname
<<
"(run): запускаемся без создания отдельного потока... "
<<
endl
;
work
();
work
();
orbthrIsFinished
=
1
;
}
}
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -290,7 +319,7 @@ void UniSetActivator::run( bool thread )
...
@@ -290,7 +319,7 @@ void UniSetActivator::run( bool thread )
*/
*/
void
UniSetActivator
::
stop
()
void
UniSetActivator
::
stop
()
{
{
// uniset_mutex_lock l(deactivateMutex, 500);
// uniset_mutex_lock l(deactivateMutex, 500);
if
(
active
)
if
(
active
)
{
{
active
=
false
;
active
=
false
;
...
@@ -299,22 +328,28 @@ void UniSetActivator::stop()
...
@@ -299,22 +328,28 @@ void UniSetActivator::stop()
deactivate
();
deactivate
();
try
{
deactivateObject
();
}
catch
(
omniORB
::
fatalException
&
fe
)
{
ucrit
<<
myname
<<
"(stop): : поймали omniORB::fatalException:"
<<
endl
;
ucrit
<<
myname
<<
"(stop): file: "
<<
fe
.
file
()
<<
endl
;
ucrit
<<
myname
<<
"(stop): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(stop): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
catch
(
std
::
exception
&
ex
)
{
ucrit
<<
myname
<<
"(stop): "
<<
ex
.
what
()
<<
endl
;
}
ulogsys
<<
myname
<<
"(stop): deactivate ok. "
<<
endl
;
ulogsys
<<
myname
<<
"(stop): deactivate ok. "
<<
endl
;
ulogsys
<<
myname
<<
"(stop): discard request..."
<<
endl
;
ulogsys
<<
myname
<<
"(stop): discard request..."
<<
endl
;
pman
->
discard_requests
(
true
);
pman
->
discard_requests
(
true
);
ulogsys
<<
myname
<<
"(stop): discard request ok."
<<
endl
;
ulogsys
<<
myname
<<
"(stop): discard request ok."
<<
endl
;
#if 1
try
{
ulogsys
<<
myname
<<
"(stop):: shutdown orb... "
<<
endl
;
orb
->
shutdown
(
true
);
}
catch
(...){}
ulogsys
<<
myname
<<
"(stop): shutdown ok."
<<
endl
;
#endif
}
}
}
}
...
@@ -330,6 +365,7 @@ void UniSetActivator::work()
...
@@ -330,6 +365,7 @@ void UniSetActivator::work()
else
else
thpid
=
getpid
();
thpid
=
getpid
();
omniORB
::
setMainThread
();
orb
->
run
();
orb
->
run
();
}
}
catch
(
CORBA
::
SystemException
&
ex
)
catch
(
CORBA
::
SystemException
&
ex
)
...
@@ -350,10 +386,12 @@ void UniSetActivator::work()
...
@@ -350,10 +386,12 @@ void UniSetActivator::work()
ulogsys
<<
myname
<<
"(work): orb thread stopped!"
<<
endl
;
ulogsys
<<
myname
<<
"(work): orb thread stopped!"
<<
endl
;
if
(
orbthr
)
{
try
try
{
{
ulogsys
<<
myname
<<
"(oaDestroy): orb destroy
... "
<<
endl
;
ulogsys
<<
myname
<<
"(work): orb shutdown
... "
<<
endl
;
orb
->
destroy
(
);
orb
->
shutdown
(
false
);
}
}
catch
(
omniORB
::
fatalException
&
fe
)
catch
(
omniORB
::
fatalException
&
fe
)
{
{
...
@@ -362,8 +400,17 @@ void UniSetActivator::work()
...
@@ -362,8 +400,17 @@ void UniSetActivator::work()
ucrit
<<
myname
<<
"(work): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(work): line: "
<<
fe
.
line
()
<<
endl
;
ucrit
<<
myname
<<
"(work): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
ucrit
<<
myname
<<
"(work): mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
catch
(
std
::
exception
&
ex
)
{
ucrit
<<
myname
<<
"(work): mesg: "
<<
ex
.
what
()
<<
endl
;
}
ulogsys
<<
myname
<<
"(work): orb shutdown ok."
<<
endl
;
}
ulogsys
<<
myname
<<
"(oaDestroy): orb destroy ok."
<<
endl
;
orbthrIsFinished
=
1
;
orbthr
=
nullptr
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetActivator
::
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
void
UniSetActivator
::
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
...
@@ -401,13 +448,13 @@ void UniSetActivator::set_signals(bool ask)
...
@@ -401,13 +448,13 @@ void UniSetActivator::set_signals(bool ask)
sigaddset
(
&
act
.
sa_mask
,
SIGTERM
);
sigaddset
(
&
act
.
sa_mask
,
SIGTERM
);
sigaddset
(
&
act
.
sa_mask
,
SIGABRT
);
sigaddset
(
&
act
.
sa_mask
,
SIGABRT
);
sigaddset
(
&
act
.
sa_mask
,
SIGQUIT
);
sigaddset
(
&
act
.
sa_mask
,
SIGQUIT
);
// sigaddset(&act.sa_mask, SIGSEGV);
// sigaddset(&act.sa_mask, SIGSEGV);
// sigaddset(&act.sa_mask, SIGALRM);
// sigaddset(&act.sa_mask, SIGALRM);
// act.sa_flags = 0;
// act.sa_flags = 0;
// act.sa_flags |= SA_RESTART;
// act.sa_flags |= SA_RESTART;
// act.sa_flags |= SA_RESETHAND;
// act.sa_flags |= SA_RESETHAND;
if
(
ask
)
if
(
ask
)
act
.
sa_handler
=
terminated
;
act
.
sa_handler
=
terminated
;
else
else
...
@@ -418,7 +465,7 @@ void UniSetActivator::set_signals(bool ask)
...
@@ -418,7 +465,7 @@ void UniSetActivator::set_signals(bool ask)
sigaction
(
SIGABRT
,
&
act
,
&
oact
);
sigaction
(
SIGABRT
,
&
act
,
&
oact
);
sigaction
(
SIGQUIT
,
&
act
,
&
oact
);
sigaction
(
SIGQUIT
,
&
act
,
&
oact
);
// sigaction(SIGSEGV, &act, &oact);
// sigaction(SIGSEGV, &act, &oact);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -469,7 +516,7 @@ void UniSetActivator::terminated( int signo )
...
@@ -469,7 +516,7 @@ void UniSetActivator::terminated( int signo )
if
(
gActivator
)
if
(
gActivator
)
{
{
ulogsys
<<
(
gActivator
?
gActivator
->
getName
()
:
""
)
<<
"(terminated): call oaDestroy.."
<<
endl
;
ulogsys
<<
(
gActivator
?
gActivator
->
getName
()
:
""
)
<<
"(terminated): call oaDestroy.."
<<
endl
;
gActivator
->
oaDestroy
(
SIGNO
);
// gActivator->term(SIGNO);
if
(
gActivator
)
gActivator
->
oaDestroy
(
SIGNO
);
// gActivator->term(SIGNO);
}
}
doneterm
=
1
;
doneterm
=
1
;
...
@@ -479,7 +526,7 @@ void UniSetActivator::terminated( int signo )
...
@@ -479,7 +526,7 @@ void UniSetActivator::terminated( int signo )
if
(
gActivator
)
if
(
gActivator
)
{
{
UniSetActivator
::
set_signals
(
false
);
UniSetActivator
::
set_signals
(
false
);
//
gActivator.reset();
gActivator
.
reset
();
}
}
sigset
(
SIGALRM
,
SIG_DFL
);
sigset
(
SIGALRM
,
SIG_DFL
);
...
@@ -492,20 +539,18 @@ void UniSetActivator::terminated( int signo )
...
@@ -492,20 +539,18 @@ void UniSetActivator::terminated( int signo )
void
UniSetActivator
::
normalexit
()
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
;
gActivator
->
stop
();
// std::exception_ptr p = std::current_exception();
}
// std::clog <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
}
}
void
UniSetActivator
::
normalterminate
()
void
UniSetActivator
::
normalterminate
()
{
{
if
(
gActivator
)
if
(
gActivator
)
{
ucrit
<<
gActivator
->
getName
()
<<
"(default exception terminate): Unkown exception.. Good bye."
<<
endl
<<
flush
;
ucrit
<<
gActivator
->
getName
()
<<
"(default exception terminate): Unkown exception.. Good bye."
<<
endl
<<
flush
;
// 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
)
...
@@ -521,15 +566,6 @@ void UniSetActivator::term( int signo )
...
@@ -521,15 +566,6 @@ void UniSetActivator::term( int signo )
try
try
{
{
ulogsys
<<
myname
<<
"(term): вызываем sigterm()"
<<
endl
;
ulogsys
<<
myname
<<
"(term): вызываем sigterm()"
<<
endl
;
if
(
orbthr
)
{
orbthr
->
stop
();
if
(
orbthr
->
isRunning
()
)
orbthr
->
join
();
orbthr
.
reset
();
}
sigterm
(
signo
);
sigterm
(
signo
);
s_term
.
emit
(
signo
);
s_term
.
emit
(
signo
);
ulogsys
<<
myname
<<
"(term): sigterm() ok."
<<
endl
;
ulogsys
<<
myname
<<
"(term): sigterm() ok."
<<
endl
;
...
...
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