Commit 057660af authored by Pavel Vainerman's avatar Pavel Vainerman

Сделал UniSetTimer в UniSetObject shared_ptr-ов

(в рамках перевода "всего и вся" на использование умных указателей из c++11).
parent 207347d9
......@@ -201,7 +201,7 @@ class UniSetObject:
friend class UniSetManager;
friend class UniSetActivator;
friend class ThreadCreator<UniSetObject>;
inline pid_t getMsgPID()
{
return msgpid;
......@@ -227,10 +227,11 @@ class UniSetObject:
std::atomic_bool active;
bool threadcreate;
UniSetTimer* tmr;
std::shared_ptr<UniSetTimer> tmr;
UniSetTypes::ObjectId myid;
CORBA::Object_var oref;
ThreadCreator<UniSetObject>* thr;
std::shared_ptr< ThreadCreator<UniSetObject> > thr;
/*! очередь сообщений для объекта */
MessagesQueue queueMsg;
......
......@@ -40,7 +40,7 @@
using namespace std;
using namespace UniSetTypes;
#define CREATE_TIMER new ThrPassiveTimer();
#define CREATE_TIMER make_shared<ThrPassiveTimer>();
// new PassiveSysTimer();
// ------------------------------------------------------------------------------------------
......@@ -51,10 +51,8 @@ msgpid(0),
reg(false),
active(0),
threadcreate(false),
tmr(NULL),
myid(UniSetTypes::DefaultObjectId),
oref(0),
thr(NULL),
SizeOfMessageQueue(1000),
MaxCountRemoveOfMessage(10),
stMaxQueueMessages(0),
......@@ -73,10 +71,8 @@ msgpid(0),
reg(false),
active(0),
threadcreate(true),
tmr(NULL),
myid(id),
oref(0),
thr(NULL),
SizeOfMessageQueue(1000),
MaxCountRemoveOfMessage(10),
stMaxQueueMessages(0),
......@@ -108,10 +104,8 @@ msgpid(0),
reg(false),
active(0),
threadcreate(true),
tmr(NULL),
myid(UniSetTypes::DefaultObjectId),
oref(0),
thr(NULL),
SizeOfMessageQueue(1000),
MaxCountRemoveOfMessage(10),
stMaxQueueMessages(0),
......@@ -155,11 +149,7 @@ UniSetObject::~UniSetObject()
thr->join();
}
catch(...){}
delete thr;
}
delete tmr;
}
// ------------------------------------------------------------------------------------------
void UniSetObject::init_object()
......@@ -446,7 +436,7 @@ CORBA::Boolean UniSetObject::exist()
// ------------------------------------------------------------------------------------------
void UniSetObject::termWaiting()
{
if( tmr!=NULL )
if( tmr )
tmr->terminate();
}
// ------------------------------------------------------------------------------------------
......@@ -747,7 +737,7 @@ bool UniSetObject::activate()
if( myid!=UniSetTypes::DefaultObjectId && threadcreate )
{
thr = new ThreadCreator<UniSetObject>(this, &UniSetObject::work);
thr = make_shared< ThreadCreator<UniSetObject> >(this, &UniSetObject::work);
thr->start();
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment