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
13259225
Commit
13259225
authored
Sep 09, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/async: eliminate attribute "postponed_error"
Switch the remaining users to "postponed_exception".
parent
7acd9133
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
32 deletions
+8
-32
AsyncInputStream.cxx
src/input/AsyncInputStream.cxx
+8
-24
AsyncInputStream.hxx
src/input/AsyncInputStream.hxx
+0
-8
No files found.
src/input/AsyncInputStream.cxx
View file @
13259225
...
...
@@ -24,6 +24,8 @@
#include "thread/Cond.hxx"
#include "IOThread.hxx"
#include <stdexcept>
#include <assert.h>
#include <string.h>
...
...
@@ -64,16 +66,6 @@ AsyncInputStream::Pause()
paused
=
true
;
}
void
AsyncInputStream
::
PostponeError
(
Error
&&
error
)
{
assert
(
io_thread_inside
());
seek_state
=
SeekState
::
NONE
;
postponed_error
=
std
::
move
(
error
);
cond
.
broadcast
();
}
inline
void
AsyncInputStream
::
Resume
()
{
...
...
@@ -87,7 +79,7 @@ AsyncInputStream::Resume()
}
bool
AsyncInputStream
::
Check
(
Error
&
error
)
AsyncInputStream
::
Check
(
Error
&
)
{
if
(
postponed_exception
)
{
auto
e
=
std
::
move
(
postponed_exception
);
...
...
@@ -95,13 +87,7 @@ AsyncInputStream::Check(Error &error)
std
::
rethrow_exception
(
e
);
}
bool
success
=
!
postponed_error
.
IsDefined
();
if
(
!
success
)
{
error
=
std
::
move
(
postponed_error
);
postponed_error
.
Clear
();
}
return
success
;
return
true
;
}
bool
...
...
@@ -121,10 +107,8 @@ AsyncInputStream::Seek(offset_type new_offset, Error &error)
/* no-op */
return
true
;
if
(
!
IsSeekable
())
{
error
.
Set
(
input_domain
,
"Not seekable"
);
return
false
;
}
if
(
!
IsSeekable
())
throw
std
::
runtime_error
(
"Not seekable"
);
/* check if we can fast-forward the buffer */
...
...
@@ -187,8 +171,7 @@ AsyncInputStream::ReadTag()
bool
AsyncInputStream
::
IsAvailable
()
{
return
postponed_error
.
IsDefined
()
||
postponed_exception
||
return
postponed_exception
||
IsEOF
()
||
!
buffer
.
IsEmpty
();
}
...
...
@@ -289,6 +272,7 @@ AsyncInputStream::DeferredSeek()
DoSeek
(
seek_offset
);
}
catch
(...)
{
seek_state
=
SeekState
::
NONE
;
postponed_exception
=
std
::
current_exception
();
cond
.
broadcast
();
}
...
...
src/input/AsyncInputStream.hxx
View file @
13259225
...
...
@@ -24,7 +24,6 @@
#include "event/DeferredCall.hxx"
#include "util/HugeAllocator.hxx"
#include "util/CircularBuffer.hxx"
#include "util/Error.hxx"
#include <exception>
...
...
@@ -67,8 +66,6 @@ class AsyncInputStream : public InputStream {
offset_type
seek_offset
;
protected
:
Error
postponed_error
;
std
::
exception_ptr
postponed_exception
;
public
:
...
...
@@ -116,11 +113,6 @@ protected:
open
=
false
;
}
/**
* Pass an error from the I/O thread to the client thread.
*/
void
PostponeError
(
Error
&&
error
);
bool
IsBufferEmpty
()
const
{
return
buffer
.
IsEmpty
();
}
...
...
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