// --- for supervisor : all strings given with setProperties
// are set in environment
- bool overwrite = true;
+// bool overwrite = true;
map<std::string,CORBA::Any>::iterator it;
for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++)
{
s+='=';
s+=value;
//char* cast because 1st arg of linux putenv function is not a const char* !!!
- int ret=putenv((char *)s.c_str());
+ putenv((char *)s.c_str());
//End of CCRT porting
//int ret = setenv(cle.c_str(), value, overwrite);
MESSAGE("--- setenv: "<<cle<<" = "<< value);
else if ( signum == SIGUSR2 ) {
signame = string("SIGUSR2 Suspend") ;// 12
}
- MESSAGE( pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_cancel/kill( "
- << signame << " ) :" << endl ) ;
- if ( ThreadId ) {
+ cout << pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_cancel/kill( "
+ << signame << " ) :" << endl ;
+ if ( ThreadId > 0 ) {
if ( signum == 0 ) {
- if ( pthread_cancel( ThreadId ) ) {
- perror("Killer pthread_cancel error") ;
+ int sts = pthread_cancel( ThreadId ) ;
+ if ( sts != 0 && sts != ESRCH ) {
+ perror("perror Killer pthread_cancel error") ;
+ cout << pthread_self() << "Killer : ThreadId " << ThreadId << " sts " << sts
+ << " errno " << errno << endl ;
return false ;
}
else {
- MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_canceled") ;
+ cout << pthread_self() << "Killer : ThreadId " << ThreadId << " pthread_canceled" << endl ;
}
}
else {
}
}
}
+ else {
+ return false ;
+ }
return true ;
}
bool Engines_Component_i::Kill_impl() {
- MESSAGE( "Engines_Component_i::Kill_impl() pthread_t "<< pthread_self()
- << " _ThreadId " << _ThreadId << endl ) ;
+ cout << "Engines_Component_i::Kill_impl() pthread_t "<< pthread_self()
+ << " _ThreadId " << _ThreadId << " errno " << errno << endl ;
bool RetVal = false ;
- if ( _ThreadId > 0 && pthread_self() != _ThreadId ) {
- RetVal = Killer( _ThreadId , 0 ) ;
- _ThreadId = (pthread_t ) -1 ;
+ if ( _ThreadId > 0 ) {
+ if ( pthread_self() != _ThreadId ) { // Do not kill myself ...
+ RetVal = Killer( _ThreadId , 0 ) ;
+ }
+ _ThreadId = 0 ;
}
return RetVal ;
}
MESSAGE( "Engines_Component_i::Stop_impl() pthread_t "<< pthread_self()
<< " _ThreadId " << _ThreadId << endl ) ;
bool RetVal = false ;
- if ( _ThreadId > 0 && pthread_self() != _ThreadId ) {
- RetVal = Killer( _ThreadId , 0 ) ;
- _ThreadId = (pthread_t ) -1 ;
+ if ( _ThreadId > 0 ) {
+ if ( pthread_self() != _ThreadId ) { // Do not kill myself ...
+ RetVal = Killer( _ThreadId , 0 ) ;
+ }
+ _ThreadId = 0 ;
}
return RetVal ;
}