Commit 5dfa1766 authored by Pavel Vainerman's avatar Pavel Vainerman

(Оптимизация): спорный способ: отказался от mutex, для "не критиной" переменной.…

(Оптимизация): спорный способ: отказался от mutex, для "не критиной" переменной. Просто сделал её atomic.
parent 8cc62046
......@@ -148,7 +148,7 @@ class UniSetObject:
inline unsigned int getMaxSizeOfMessageQueue()
{ return SizeOfMessageQueue; }
void setMaxCountRemoveOfMessage( unsigned int m )
{
if( m >=0 )
......@@ -184,14 +184,14 @@ class UniSetObject:
*/
virtual void cleanMsgQueue( MessagesQueue& q );
bool isActive();
void setActive( bool set );
inline bool isActive(){ return active; }
inline void setActive( bool set ){ active = set ? 1 : 0; }
UniSetTypes::VoidMessage msg;
UniSetTypes::VoidMessage msg;
UniSetManager* mymngr;
void setThreadPriority( int p );
private:
friend class UniSetManager;
......@@ -219,8 +219,8 @@ class UniSetObject:
pid_t msgpid; // pid потока обработки сообщений
bool reg;
bool active;
UniSetTypes::uniset_rwmutex mutex_act;
UniSetTypes::mutex_atomic_t active;
// UniSetTypes::uniset_rwmutex mutex_act;
bool threadcreate;
UniSetTimer* tmr;
UniSetTypes::ObjectId myid;
......@@ -240,7 +240,7 @@ class UniSetObject:
unsigned int SizeOfMessageQueue;
/*! сколько сообщений удалять при очисте*/
unsigned int MaxCountRemoveOfMessage;
// статистическая информация
unsigned long stMaxQueueMessages; /*<! Максимальное число сообщений хранившихся в очереди */
unsigned long stCountOfQueueFull; /*! количество переполнений очереди сообщений */
......
......@@ -49,7 +49,7 @@ ui(UniSetTypes::DefaultObjectId),
mymngr(NULL),
msgpid(0),
reg(false),
active(false),
active(0),
threadcreate(false),
tmr(NULL),
myid(UniSetTypes::DefaultObjectId),
......@@ -71,7 +71,7 @@ ui(id),
mymngr(NULL),
msgpid(0),
reg(false),
active(false),
active(0),
threadcreate(true),
tmr(NULL),
myid(id),
......@@ -106,7 +106,7 @@ ui(UniSetTypes::DefaultObjectId),
mymngr(NULL),
msgpid(0),
reg(false),
active(false),
active(0),
threadcreate(true),
tmr(NULL),
myid(UniSetTypes::DefaultObjectId),
......@@ -147,7 +147,7 @@ void UniSetObject::init_object()
{
qmutex.setName(myname + "_qmutex");
refmutex.setName(myname + "_refmutex");
mutex_act.setName(myname + "_mutex_act");
// mutex_act.setName(myname + "_mutex_act");
SizeOfMessageQueue = conf->getArgPInt("--uniset-object-size-message-queue",conf->getField("SizeOfMessageQueue"), 1000);
MaxCountRemoveOfMessage = conf->getArgInt("--uniset-object-maxcount-remove-message",conf->getField("MaxCountRemoveOfMessage"));
......@@ -726,9 +726,7 @@ bool UniSetObject::activate()
// Activate object...
poa->activate_object_with_id(oid, this);
}
{
UniSetTypes::uniset_rwmutex_wrlock lock(refmutex);
oref = poa->servant_to_reference(static_cast<PortableServer::ServantBase*>(this) );
......@@ -877,20 +875,8 @@ bool UniSetObject::PriorVMsgCompare::operator()(const UniSetTypes::VoidMessage&
return lhs.tm.tv_usec >= rhs.tm.tv_usec;
return lhs.tm.tv_sec >= rhs.tm.tv_sec;
}
return lhs.priority < rhs.priority;
}
// ------------------------------------------------------------------------------------------
void UniSetObject::setActive( bool set )
{
uniset_rwmutex_wrlock l(mutex_act);
active = set;
}
// ------------------------------------------------------------------------------------------
bool UniSetObject::isActive()
{
uniset_rwmutex_rlock l(mutex_act);
return active;
}
// ------------------------------------------------------------------------------------------
#undef CREATE_TIMER
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