Add context-aware read/write (#57)
Adds ReadContext/WriteContext methods to endpoints and to streams. Update rawread example tool to use ReadContext for implementation of "timeout" flag.
This commit is contained in:

committed by
GitHub

parent
593cfb67e9
commit
da849d96b5
@@ -16,6 +16,7 @@ package gousb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -57,7 +58,7 @@ func (f *fakeStreamTransfer) submit() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *fakeStreamTransfer) wait() (int, error) {
|
||||
func (f *fakeStreamTransfer) wait(ctx context.Context) (int, error) {
|
||||
if f.released {
|
||||
return 0, errors.New("wait() called on a free()d transfer")
|
||||
}
|
||||
|
Reference in New Issue
Block a user