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
5dfa1766
Commit
5dfa1766
authored
Jan 27, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Оптимизация): спорный способ: отказался от mutex, для "не критиной" переменной.…
(Оптимизация): спорный способ: отказался от mutex, для "не критиной" переменной. Просто сделал её atomic.
parent
8cc62046
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
27 deletions
+13
-27
UniSetObject.h
include/UniSetObject.h
+8
-8
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+5
-19
No files found.
include/UniSetObject.h
View file @
5dfa1766
...
@@ -148,7 +148,7 @@ class UniSetObject:
...
@@ -148,7 +148,7 @@ class UniSetObject:
inline
unsigned
int
getMaxSizeOfMessageQueue
()
inline
unsigned
int
getMaxSizeOfMessageQueue
()
{
return
SizeOfMessageQueue
;
}
{
return
SizeOfMessageQueue
;
}
void
setMaxCountRemoveOfMessage
(
unsigned
int
m
)
void
setMaxCountRemoveOfMessage
(
unsigned
int
m
)
{
{
if
(
m
>=
0
)
if
(
m
>=
0
)
...
@@ -184,14 +184,14 @@ class UniSetObject:
...
@@ -184,14 +184,14 @@ class UniSetObject:
*/
*/
virtual
void
cleanMsgQueue
(
MessagesQueue
&
q
);
virtual
void
cleanMsgQueue
(
MessagesQueue
&
q
);
bool
isActive
();
inline
bool
isActive
(){
return
active
;
}
void
setActive
(
bool
set
);
inline
void
setActive
(
bool
set
){
active
=
set
?
1
:
0
;
}
UniSetTypes
::
VoidMessage
msg
;
UniSetTypes
::
VoidMessage
msg
;
UniSetManager
*
mymngr
;
UniSetManager
*
mymngr
;
void
setThreadPriority
(
int
p
);
void
setThreadPriority
(
int
p
);
private
:
private
:
friend
class
UniSetManager
;
friend
class
UniSetManager
;
...
@@ -219,8 +219,8 @@ class UniSetObject:
...
@@ -219,8 +219,8 @@ class UniSetObject:
pid_t
msgpid
;
// pid потока обработки сообщений
pid_t
msgpid
;
// pid потока обработки сообщений
bool
reg
;
bool
reg
;
bool
active
;
UniSetTypes
::
mutex_atomic_t
active
;
UniSetTypes
::
uniset_rwmutex
mutex_act
;
//
UniSetTypes::uniset_rwmutex mutex_act;
bool
threadcreate
;
bool
threadcreate
;
UniSetTimer
*
tmr
;
UniSetTimer
*
tmr
;
UniSetTypes
::
ObjectId
myid
;
UniSetTypes
::
ObjectId
myid
;
...
@@ -240,7 +240,7 @@ class UniSetObject:
...
@@ -240,7 +240,7 @@ class UniSetObject:
unsigned
int
SizeOfMessageQueue
;
unsigned
int
SizeOfMessageQueue
;
/*! сколько сообщений удалять при очисте*/
/*! сколько сообщений удалять при очисте*/
unsigned
int
MaxCountRemoveOfMessage
;
unsigned
int
MaxCountRemoveOfMessage
;
// статистическая информация
// статистическая информация
unsigned
long
stMaxQueueMessages
;
/*<! Максимальное число сообщений хранившихся в очереди */
unsigned
long
stMaxQueueMessages
;
/*<! Максимальное число сообщений хранившихся в очереди */
unsigned
long
stCountOfQueueFull
;
/*! количество переполнений очереди сообщений */
unsigned
long
stCountOfQueueFull
;
/*! количество переполнений очереди сообщений */
...
...
src/ObjectRepository/UniSetObject.cc
View file @
5dfa1766
...
@@ -49,7 +49,7 @@ ui(UniSetTypes::DefaultObjectId),
...
@@ -49,7 +49,7 @@ ui(UniSetTypes::DefaultObjectId),
mymngr
(
NULL
),
mymngr
(
NULL
),
msgpid
(
0
),
msgpid
(
0
),
reg
(
false
),
reg
(
false
),
active
(
false
),
active
(
0
),
threadcreate
(
false
),
threadcreate
(
false
),
tmr
(
NULL
),
tmr
(
NULL
),
myid
(
UniSetTypes
::
DefaultObjectId
),
myid
(
UniSetTypes
::
DefaultObjectId
),
...
@@ -71,7 +71,7 @@ ui(id),
...
@@ -71,7 +71,7 @@ ui(id),
mymngr
(
NULL
),
mymngr
(
NULL
),
msgpid
(
0
),
msgpid
(
0
),
reg
(
false
),
reg
(
false
),
active
(
false
),
active
(
0
),
threadcreate
(
true
),
threadcreate
(
true
),
tmr
(
NULL
),
tmr
(
NULL
),
myid
(
id
),
myid
(
id
),
...
@@ -106,7 +106,7 @@ ui(UniSetTypes::DefaultObjectId),
...
@@ -106,7 +106,7 @@ ui(UniSetTypes::DefaultObjectId),
mymngr
(
NULL
),
mymngr
(
NULL
),
msgpid
(
0
),
msgpid
(
0
),
reg
(
false
),
reg
(
false
),
active
(
false
),
active
(
0
),
threadcreate
(
true
),
threadcreate
(
true
),
tmr
(
NULL
),
tmr
(
NULL
),
myid
(
UniSetTypes
::
DefaultObjectId
),
myid
(
UniSetTypes
::
DefaultObjectId
),
...
@@ -147,7 +147,7 @@ void UniSetObject::init_object()
...
@@ -147,7 +147,7 @@ void UniSetObject::init_object()
{
{
qmutex
.
setName
(
myname
+
"_qmutex"
);
qmutex
.
setName
(
myname
+
"_qmutex"
);
refmutex
.
setName
(
myname
+
"_refmutex"
);
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
);
SizeOfMessageQueue
=
conf
->
getArgPInt
(
"--uniset-object-size-message-queue"
,
conf
->
getField
(
"SizeOfMessageQueue"
),
1000
);
MaxCountRemoveOfMessage
=
conf
->
getArgInt
(
"--uniset-object-maxcount-remove-message"
,
conf
->
getField
(
"MaxCountRemoveOfMessage"
));
MaxCountRemoveOfMessage
=
conf
->
getArgInt
(
"--uniset-object-maxcount-remove-message"
,
conf
->
getField
(
"MaxCountRemoveOfMessage"
));
...
@@ -726,9 +726,7 @@ bool UniSetObject::activate()
...
@@ -726,9 +726,7 @@ bool UniSetObject::activate()
// Activate object...
// Activate object...
poa
->
activate_object_with_id
(
oid
,
this
);
poa
->
activate_object_with_id
(
oid
,
this
);
}
}
{
{
UniSetTypes
::
uniset_rwmutex_wrlock
lock
(
refmutex
);
UniSetTypes
::
uniset_rwmutex_wrlock
lock
(
refmutex
);
oref
=
poa
->
servant_to_reference
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
)
);
oref
=
poa
->
servant_to_reference
(
static_cast
<
PortableServer
::
ServantBase
*>
(
this
)
);
...
@@ -877,20 +875,8 @@ bool UniSetObject::PriorVMsgCompare::operator()(const UniSetTypes::VoidMessage&
...
@@ -877,20 +875,8 @@ bool UniSetObject::PriorVMsgCompare::operator()(const UniSetTypes::VoidMessage&
return
lhs
.
tm
.
tv_usec
>=
rhs
.
tm
.
tv_usec
;
return
lhs
.
tm
.
tv_usec
>=
rhs
.
tm
.
tv_usec
;
return
lhs
.
tm
.
tv_sec
>=
rhs
.
tm
.
tv_sec
;
return
lhs
.
tm
.
tv_sec
>=
rhs
.
tm
.
tv_sec
;
}
}
return
lhs
.
priority
<
rhs
.
priority
;
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
#undef CREATE_TIMER
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