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
7cd53fb4
Commit
7cd53fb4
authored
Oct 11, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ThreadInputStream: add assertions
parent
538ddf7a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
ThreadInputStream.cxx
src/input/ThreadInputStream.cxx
+8
-0
No files found.
src/input/ThreadInputStream.cxx
View file @
7cd53fb4
...
@@ -118,6 +118,8 @@ ThreadInputStream::ThreadFunc(void *ctx)
...
@@ -118,6 +118,8 @@ ThreadInputStream::ThreadFunc(void *ctx)
bool
bool
ThreadInputStream
::
Check
(
Error
&
error
)
ThreadInputStream
::
Check
(
Error
&
error
)
{
{
assert
(
!
thread
.
IsInside
());
if
(
postponed_error
.
IsDefined
())
{
if
(
postponed_error
.
IsDefined
())
{
error
=
std
::
move
(
postponed_error
);
error
=
std
::
move
(
postponed_error
);
return
false
;
return
false
;
...
@@ -129,12 +131,16 @@ ThreadInputStream::Check(Error &error)
...
@@ -129,12 +131,16 @@ ThreadInputStream::Check(Error &error)
bool
bool
ThreadInputStream
::
IsAvailable
()
ThreadInputStream
::
IsAvailable
()
{
{
assert
(
!
thread
.
IsInside
());
return
!
buffer
->
IsEmpty
()
||
eof
||
postponed_error
.
IsDefined
();
return
!
buffer
->
IsEmpty
()
||
eof
||
postponed_error
.
IsDefined
();
}
}
inline
size_t
inline
size_t
ThreadInputStream
::
Read
(
void
*
ptr
,
size_t
read_size
,
Error
&
error
)
ThreadInputStream
::
Read
(
void
*
ptr
,
size_t
read_size
,
Error
&
error
)
{
{
assert
(
!
thread
.
IsInside
());
while
(
true
)
{
while
(
true
)
{
if
(
postponed_error
.
IsDefined
())
{
if
(
postponed_error
.
IsDefined
())
{
error
=
std
::
move
(
postponed_error
);
error
=
std
::
move
(
postponed_error
);
...
@@ -161,5 +167,7 @@ ThreadInputStream::Read(void *ptr, size_t read_size, Error &error)
...
@@ -161,5 +167,7 @@ ThreadInputStream::Read(void *ptr, size_t read_size, Error &error)
bool
bool
ThreadInputStream
::
IsEOF
()
ThreadInputStream
::
IsEOF
()
{
{
assert
(
!
thread
.
IsInside
());
return
eof
;
return
eof
;
}
}
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