Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
f069320c
Commit
f069320c
authored
Jul 04, 2016
by
legoc
Browse files
changed TimeCondition member to auto ptr
parent
e7b5fecc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cameo/ConnectionChecker.cpp
View file @
f069320c
...
...
@@ -15,6 +15,7 @@
*/
#include
"ConnectionChecker.h"
#include
"impl/TimeCondition.h"
#include
"Server.h"
using
namespace
std
;
...
...
@@ -22,6 +23,7 @@ using namespace std;
namespace
cameo
{
ConnectionChecker
::
ConnectionChecker
(
Server
*
server
,
ConnectionChecker
::
FunctionType
handler
)
:
m_server
(
server
),
m_function
(
handler
)
{
m_waitCondition
.
reset
(
new
TimeCondition
());
}
ConnectionChecker
::~
ConnectionChecker
()
{
...
...
@@ -32,7 +34,7 @@ void ConnectionChecker::loop(int timeoutMs, int pollingTimeMs) {
// Loop until the condition is notified.
while
(
true
)
{
bool
stopped
=
m_waitCondition
.
wait
(
pollingTimeMs
);
bool
stopped
=
m_waitCondition
->
wait
(
pollingTimeMs
);
if
(
stopped
)
{
return
;
}
...
...
@@ -57,7 +59,7 @@ void ConnectionChecker::startThread(int timeoutMs, int pollingTimeMs) {
void
ConnectionChecker
::
stopThread
()
{
if
(
m_thread
.
get
()
!=
0
)
{
m_waitCondition
.
notify
();
m_waitCondition
->
notify
();
m_thread
->
join
();
}
}
...
...
src/cameo/ConnectionChecker.h
View file @
f069320c
...
...
@@ -17,7 +17,6 @@
#ifndef CAMEO_CONNECTIONCHECKER_H_
#define CAMEO_CONNECTIONCHECKER_H_
#include
"impl/TimeCondition.h"
#include
<boost/function.hpp>
#include
<boost/thread.hpp>
#include
<boost/bind.hpp>
...
...
@@ -28,6 +27,7 @@
namespace
cameo
{
class
Server
;
class
TimeCondition
;
/**
* Class providing a simple connection checker.
...
...
@@ -49,7 +49,7 @@ private:
void
loop
(
int
timeoutMs
,
int
pollingTimeMs
);
Server
*
m_server
;
TimeCondition
m_waitCondition
;
std
::
auto_ptr
<
TimeCondition
>
m_waitCondition
;
FunctionType
m_function
;
std
::
auto_ptr
<
boost
::
thread
>
m_thread
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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