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
057660af
Commit
057660af
authored
Jan 08, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Сделал UniSetTimer в UniSetObject shared_ptr-ов
(в рамках перевода "всего и вся" на использование умных указателей из c++11).
parent
207347d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
16 deletions
+7
-16
UniSetObject.h
include/UniSetObject.h
+4
-3
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+3
-13
No files found.
include/UniSetObject.h
View file @
057660af
...
@@ -201,7 +201,7 @@ class UniSetObject:
...
@@ -201,7 +201,7 @@ class UniSetObject:
friend
class
UniSetManager
;
friend
class
UniSetManager
;
friend
class
UniSetActivator
;
friend
class
UniSetActivator
;
friend
class
ThreadCreator
<
UniSetObject
>
;
inline
pid_t
getMsgPID
()
inline
pid_t
getMsgPID
()
{
{
return
msgpid
;
return
msgpid
;
...
@@ -227,10 +227,11 @@ class UniSetObject:
...
@@ -227,10 +227,11 @@ class UniSetObject:
std
::
atomic_bool
active
;
std
::
atomic_bool
active
;
bool
threadcreate
;
bool
threadcreate
;
UniSetTimer
*
tmr
;
std
::
shared_ptr
<
UniSetTimer
>
tmr
;
UniSetTypes
::
ObjectId
myid
;
UniSetTypes
::
ObjectId
myid
;
CORBA
::
Object_var
oref
;
CORBA
::
Object_var
oref
;
ThreadCreator
<
UniSetObject
>*
thr
;
std
::
shared_ptr
<
ThreadCreator
<
UniSetObject
>
>
thr
;
/*! очередь сообщений для объекта */
/*! очередь сообщений для объекта */
MessagesQueue
queueMsg
;
MessagesQueue
queueMsg
;
...
...
src/ObjectRepository/UniSetObject.cc
View file @
057660af
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
#define CREATE_TIMER
new ThrPassiveTimer();
#define CREATE_TIMER
make_shared<ThrPassiveTimer>();
// new PassiveSysTimer();
// new PassiveSysTimer();
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -51,10 +51,8 @@ msgpid(0),
...
@@ -51,10 +51,8 @@ msgpid(0),
reg
(
false
),
reg
(
false
),
active
(
0
),
active
(
0
),
threadcreate
(
false
),
threadcreate
(
false
),
tmr
(
NULL
),
myid
(
UniSetTypes
::
DefaultObjectId
),
myid
(
UniSetTypes
::
DefaultObjectId
),
oref
(
0
),
oref
(
0
),
thr
(
NULL
),
SizeOfMessageQueue
(
1000
),
SizeOfMessageQueue
(
1000
),
MaxCountRemoveOfMessage
(
10
),
MaxCountRemoveOfMessage
(
10
),
stMaxQueueMessages
(
0
),
stMaxQueueMessages
(
0
),
...
@@ -73,10 +71,8 @@ msgpid(0),
...
@@ -73,10 +71,8 @@ msgpid(0),
reg
(
false
),
reg
(
false
),
active
(
0
),
active
(
0
),
threadcreate
(
true
),
threadcreate
(
true
),
tmr
(
NULL
),
myid
(
id
),
myid
(
id
),
oref
(
0
),
oref
(
0
),
thr
(
NULL
),
SizeOfMessageQueue
(
1000
),
SizeOfMessageQueue
(
1000
),
MaxCountRemoveOfMessage
(
10
),
MaxCountRemoveOfMessage
(
10
),
stMaxQueueMessages
(
0
),
stMaxQueueMessages
(
0
),
...
@@ -108,10 +104,8 @@ msgpid(0),
...
@@ -108,10 +104,8 @@ msgpid(0),
reg
(
false
),
reg
(
false
),
active
(
0
),
active
(
0
),
threadcreate
(
true
),
threadcreate
(
true
),
tmr
(
NULL
),
myid
(
UniSetTypes
::
DefaultObjectId
),
myid
(
UniSetTypes
::
DefaultObjectId
),
oref
(
0
),
oref
(
0
),
thr
(
NULL
),
SizeOfMessageQueue
(
1000
),
SizeOfMessageQueue
(
1000
),
MaxCountRemoveOfMessage
(
10
),
MaxCountRemoveOfMessage
(
10
),
stMaxQueueMessages
(
0
),
stMaxQueueMessages
(
0
),
...
@@ -155,11 +149,7 @@ UniSetObject::~UniSetObject()
...
@@ -155,11 +149,7 @@ UniSetObject::~UniSetObject()
thr
->
join
();
thr
->
join
();
}
}
catch
(...){}
catch
(...){}
delete
thr
;
}
}
delete
tmr
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetObject
::
init_object
()
void
UniSetObject
::
init_object
()
...
@@ -446,7 +436,7 @@ CORBA::Boolean UniSetObject::exist()
...
@@ -446,7 +436,7 @@ CORBA::Boolean UniSetObject::exist()
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetObject
::
termWaiting
()
void
UniSetObject
::
termWaiting
()
{
{
if
(
tmr
!=
NULL
)
if
(
tmr
)
tmr
->
terminate
();
tmr
->
terminate
();
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -747,7 +737,7 @@ bool UniSetObject::activate()
...
@@ -747,7 +737,7 @@ bool UniSetObject::activate()
if
(
myid
!=
UniSetTypes
::
DefaultObjectId
&&
threadcreate
)
if
(
myid
!=
UniSetTypes
::
DefaultObjectId
&&
threadcreate
)
{
{
thr
=
new
ThreadCreator
<
UniSetObject
>
(
this
,
&
UniSetObject
::
work
);
thr
=
make_shared
<
ThreadCreator
<
UniSetObject
>
>
(
this
,
&
UniSetObject
::
work
);
thr
->
start
();
thr
->
start
();
}
}
else
else
...
...
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