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
973c87b3
Commit
973c87b3
authored
May 07, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/Call, ...: use wait() with predicate
parent
72fc1173
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
20 additions
and
35 deletions
+20
-35
Call.cxx
src/event/Call.cxx
+1
-2
AsyncInputStream.cxx
src/input/AsyncInputStream.cxx
+2
-2
BufferedInputStream.cxx
src/input/BufferedInputStream.cxx
+1
-2
Open.cxx
src/input/Open.cxx
+3
-6
ProxyInputStream.cxx
src/input/ProxyInputStream.cxx
+2
-4
Control.cxx
src/output/Control.cxx
+1
-2
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+1
-2
HttpdOutputPlugin.cxx
src/output/plugins/httpd/HttpdOutputPlugin.cxx
+1
-2
SlesOutputPlugin.cxx
src/output/plugins/sles/SlesOutputPlugin.cxx
+4
-5
CurlStorage.cxx
src/storage/plugins/CurlStorage.cxx
+1
-2
UdisksStorage.cxx
src/storage/plugins/UdisksStorage.cxx
+2
-4
run_input.cxx
test/run_input.cxx
+1
-2
No files found.
src/event/Call.cxx
View file @
973c87b3
...
...
@@ -53,8 +53,7 @@ public:
{
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
while
(
!
done
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
done
;
});
}
if
(
exception
)
...
...
src/input/AsyncInputStream.cxx
View file @
973c87b3
...
...
@@ -136,8 +136,8 @@ AsyncInputStream::Seek(std::unique_lock<Mutex> &lock,
CondInputStreamHandler
cond_handler
;
const
ScopeExchangeInputStreamHandler
h
(
*
this
,
&
cond_handler
);
while
(
seek_state
!=
SeekState
::
NONE
)
cond_handler
.
cond
.
wait
(
lock
);
cond_handler
.
cond
.
wait
(
lock
,
[
this
]{
return
seek_state
==
SeekState
::
NONE
;
}
);
Check
();
}
...
...
src/input/BufferedInputStream.cxx
View file @
973c87b3
...
...
@@ -84,8 +84,7 @@ BufferedInputStream::Seek(std::unique_lock<Mutex> &lock,
seek
=
true
;
wake_cond
.
notify_one
();
while
(
seek
)
client_cond
.
wait
(
lock
);
client_cond
.
wait
(
lock
,
[
this
]{
return
!
seek
;
});
if
(
seek_error
)
std
::
rethrow_exception
(
std
::
exchange
(
seek_error
,
{}));
...
...
src/input/Open.cxx
View file @
973c87b3
...
...
@@ -59,13 +59,10 @@ InputStream::OpenReady(const char *uri, Mutex &mutex)
{
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
while
(
true
)
{
handler
.
cond
.
wait
(
lock
,
[
&
is
]
{
is
->
Update
();
if
(
is
->
IsReady
())
break
;
handler
.
cond
.
wait
(
lock
);
}
return
is
->
IsReady
();
});
is
->
Check
();
}
...
...
src/input/ProxyInputStream.cxx
View file @
973c87b3
...
...
@@ -92,8 +92,7 @@ void
ProxyInputStream
::
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
new_offset
)
{
while
(
!
input
)
set_input_cond
.
wait
(
lock
);
set_input_cond
.
wait
(
lock
,
[
this
]{
return
!!
input
;
});
input
->
Seek
(
lock
,
new_offset
);
CopyAttributes
();
...
...
@@ -124,8 +123,7 @@ size_t
ProxyInputStream
::
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
read_size
)
{
while
(
!
input
)
set_input_cond
.
wait
(
lock
);
set_input_cond
.
wait
(
lock
,
[
this
]{
return
!!
input
;
});
size_t
nbytes
=
input
->
Read
(
lock
,
ptr
,
read_size
);
CopyAttributes
();
...
...
src/output/Control.cxx
View file @
973c87b3
...
...
@@ -114,8 +114,7 @@ AudioOutputControl::LockToggleEnabled() noexcept
void
AudioOutputControl
::
WaitForCommand
(
std
::
unique_lock
<
Mutex
>
&
lock
)
noexcept
{
while
(
!
IsCommandFinished
())
client_cond
.
wait
(
lock
);
client_cond
.
wait
(
lock
,
[
this
]{
return
IsCommandFinished
();
});
}
void
...
...
src/output/plugins/AlsaOutputPlugin.cxx
View file @
973c87b3
...
...
@@ -805,8 +805,7 @@ AlsaOutput::Drain()
Activate
();
while
(
drain
&&
active
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
!
drain
||
!
active
;
});
if
(
error
)
std
::
rethrow_exception
(
error
);
...
...
src/output/plugins/httpd/HttpdOutputPlugin.cxx
View file @
973c87b3
...
...
@@ -278,8 +278,7 @@ HttpdOutput::BroadcastFromEncoder()
/* synchronize with the IOThread */
{
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
while
(
!
pages
.
empty
())
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
pages
.
empty
();
});
}
bool
empty
=
true
;
...
...
src/output/plugins/sles/SlesOutputPlugin.cxx
View file @
973c87b3
...
...
@@ -321,10 +321,10 @@ SlesOutput::Play(const void *chunk, size_t size)
assert
(
filled
<
BUFFER_SIZE
);
while
(
n_queued
==
N_BUFFERS
)
{
cond
.
wait
(
lock
,
[
this
]
{
assert
(
filled
==
0
);
cond
.
wait
(
lock
)
;
}
return
n_queued
!=
N_BUFFERS
;
}
);
size_t
nbytes
=
std
::
min
(
BUFFER_SIZE
-
filled
,
size
);
memcpy
(
buffers
[
next
]
+
filled
,
chunk
,
nbytes
);
...
...
@@ -350,8 +350,7 @@ SlesOutput::Drain()
assert
(
filled
<
BUFFER_SIZE
);
while
(
n_queued
>
0
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
n_queued
==
0
;
});
}
void
...
...
src/storage/plugins/CurlStorage.cxx
View file @
973c87b3
...
...
@@ -125,8 +125,7 @@ public:
void
Wait
()
{
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
while
(
!
done
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
done
;
});
if
(
postponed_error
)
std
::
rethrow_exception
(
postponed_error
);
...
...
src/storage/plugins/UdisksStorage.cxx
View file @
973c87b3
...
...
@@ -209,8 +209,7 @@ UdisksStorage::MountWait()
defer_mount
.
Schedule
();
}
while
(
want_mount
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
!
want_mount
;
});
if
(
mount_error
)
std
::
rethrow_exception
(
mount_error
);
...
...
@@ -280,8 +279,7 @@ UdisksStorage::UnmountWait()
defer_unmount
.
Schedule
();
while
(
mounted_storage
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
!
mounted_storage
;
});
if
(
mount_error
)
std
::
rethrow_exception
(
mount_error
);
...
...
test/run_input.cxx
View file @
973c87b3
...
...
@@ -176,8 +176,7 @@ class DumpRemoteTagHandler final : public RemoteTagHandler {
public
:
Tag
Wait
()
{
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
while
(
!
done
)
cond
.
wait
(
lock
);
cond
.
wait
(
lock
,
[
this
]{
return
done
;
});
if
(
error
)
std
::
rethrow_exception
(
error
);
...
...
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