mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
Simplify rac.concReader.nextWork
This commit is contained in:
1 parent
c3f45a7aed
commit
cb40bbc26c
1 file changed
+3
-7
@@ -251,19 +251,15 @@ func (c *concReader) Read(p []byte) (int, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
work, err := c.nextWork()
|
c.currWork = c.nextWork()
|
||||||
if err != nil {
|
|
||||||
return numRead, err
|
|
||||||
}
|
|
||||||
c.currWork = work
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *concReader) nextWork() (rWork, error) {
|
func (c *concReader) nextWork() rWork {
|
||||||
for {
|
for {
|
||||||
if work, ok := c.completedWorks[c.pos]; ok {
|
if work, ok := c.completedWorks[c.pos]; ok {
|
||||||
delete(c.completedWorks, c.pos)
|
delete(c.completedWorks, c.pos)
|
||||||
return work, nil
|
return work
|
||||||
}
|
}
|
||||||
work := <-c.resc
|
work := <-c.resc
|
||||||
c.completedWorks[work.dRange[0]] = work
|
c.completedWorks[work.dRange[0]] = work
|
||||||
|
|||||||
Reference in new issue
Block a user