Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
598bb93c
Commit
598bb93c
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StateFile: migrate from TimeoutMonitor to TimerEvent
parent
dc531b64
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
StateFile.cxx
src/StateFile.cxx
+4
-4
StateFile.hxx
src/StateFile.hxx
+5
-4
No files found.
src/StateFile.cxx
View file @
598bb93c
...
...
@@ -42,9 +42,9 @@ constexpr std::chrono::steady_clock::duration StateFile::DEFAULT_INTERVAL;
StateFile
::
StateFile
(
AllocatedPath
&&
_path
,
std
::
chrono
::
steady_clock
::
duration
_interval
,
Partition
&
_partition
,
EventLoop
&
_loop
)
:
TimeoutMonitor
(
_loop
),
path
(
std
::
move
(
_path
)),
path_utf8
(
path
.
ToUTF8
()),
:
path
(
std
::
move
(
_path
)),
path_utf8
(
path
.
ToUTF8
()),
interval
(
_interval
),
timer_event
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
)),
partition
(
_partition
)
{
}
...
...
@@ -137,8 +137,8 @@ try {
void
StateFile
::
CheckModified
()
{
if
(
!
IsActive
()
&&
IsModified
())
Schedule
(
interval
);
if
(
!
timer_event
.
IsActive
()
&&
IsModified
())
timer_event
.
Schedule
(
interval
);
}
void
...
...
This diff is collapsed.
Click to expand it.
src/StateFile.hxx
View file @
598bb93c
...
...
@@ -20,7 +20,7 @@
#ifndef MPD_STATE_FILE_HXX
#define MPD_STATE_FILE_HXX
#include "event/Time
outMonitor
.hxx"
#include "event/Time
rEvent
.hxx"
#include "fs/AllocatedPath.hxx"
#include "Compiler.h"
...
...
@@ -31,11 +31,12 @@ struct Partition;
class
OutputStream
;
class
BufferedOutputStream
;
class
StateFile
final
:
private
TimeoutMonitor
{
class
StateFile
final
{
const
AllocatedPath
path
;
const
std
::
string
path_utf8
;
const
std
::
chrono
::
steady_clock
::
duration
interval
;
TimerEvent
timer_event
;
Partition
&
partition
;
...
...
@@ -76,8 +77,8 @@ private:
gcc_pure
bool
IsModified
()
const
noexcept
;
/*
virtual methods from TimeoutMonitor
*/
void
OnTimeout
()
override
;
/*
callback for #timer_event
*/
void
OnTimeout
();
};
#endif
/* STATE_FILE_H */
This diff is collapsed.
Click to expand it.
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