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
620a39af
Commit
620a39af
authored
May 29, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thread/Slack: use std::chrono::duration
parent
14cee01b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
13 deletions
+10
-13
Main.cxx
src/Main.cxx
+1
-1
Thread.cxx
src/event/Thread.cxx
+1
-1
Thread.cxx
src/output/Thread.cxx
+1
-1
Slack.hxx
src/thread/Slack.hxx
+7
-10
No files found.
src/Main.cxx
View file @
620a39af
...
...
@@ -589,7 +589,7 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
/* the MPD frontend does not care about timer slack; set it to
a huge value to allow the kernel to reduce CPU wakeups */
SetThreadTimerSlack
MS
(
100
);
SetThreadTimerSlack
(
std
::
chrono
::
milliseconds
(
100
)
);
#ifdef ENABLE_SYSTEMD_DAEMON
sd_notify
(
0
,
"READY=1"
);
...
...
src/event/Thread.cxx
View file @
620a39af
...
...
@@ -52,7 +52,7 @@ EventThread::Run() noexcept
SetThreadName
(
realtime
?
"rtio"
:
"io"
);
if
(
realtime
)
{
SetThreadTimerSlack
US
(
10
);
SetThreadTimerSlack
(
std
::
chrono
::
microseconds
(
10
)
);
try
{
SetThreadRealtime
();
...
...
src/output/Thread.cxx
View file @
620a39af
...
...
@@ -410,7 +410,7 @@ AudioOutputControl::Task() noexcept
"OutputThread could not get realtime scheduling, continuing anyway"
);
}
SetThreadTimerSlack
US
(
100
);
SetThreadTimerSlack
(
std
::
chrono
::
microseconds
(
100
)
);
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
...
...
src/thread/Slack.hxx
View file @
620a39af
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -22,6 +22,8 @@
#include "config.h"
#include <chrono>
#ifdef HAVE_PRCTL
#include <sys/prctl.h>
#endif
...
...
@@ -41,16 +43,11 @@ SetThreadTimerSlackNS(unsigned long slack_ns) noexcept
#endif
}
static
inline
void
SetThreadTimerSlackUS
(
unsigned
long
slack_us
)
noexcept
{
SetThreadTimerSlackNS
(
slack_us
*
1000ul
);
}
static
inline
void
SetThreadTimerSlackMS
(
unsigned
long
slack_ms
)
noexcept
template
<
class
Rep
,
class
Period
>
static
inline
auto
SetThreadTimerSlack
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>
&
slack
)
noexcept
{
SetThreadTimerSlackNS
(
s
lack_ms
*
1000000ul
);
SetThreadTimerSlackNS
(
s
td
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
slack
).
count
()
);
}
#endif
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