@@ -23,13 +23,13 @@ type aiocb struct {
23
23
24
24
// OpResult is the result of an aysnc-io
25
25
type OpResult struct {
26
- // related file descriptor to this result
26
+ // Related file descriptor to this result
27
27
Fd int
28
- // if the operation is Write, buffer is the original committed one
29
- // if the operation is Read, buffer points to internal buffer, you need
28
+ // If the operation is Write, buffer is the original committed one,
29
+ // if the operation is Read, buffer points to a internal buffer, you need
30
30
// to process immediately, or copy and save by yourself.
31
31
Buffer []byte
32
- // number of bytes sent or received, Buffer[:Size] is the content
32
+ // Number of bytes sent or received, Buffer[:Size] is the content sent or received.
33
33
Size int
34
34
// IO error
35
35
Err error
@@ -147,7 +147,8 @@ func (w *Watcher) StopWatch(fd int) {
147
147
}
148
148
}
149
149
150
- // Read submits a read requests and notify with done, the cap(done) must be 0, i.e unbuffered chan.
150
+ // Read submits a read requests and notify IO-completion with done channel,
151
+ // the capacity of done has to be be 0, i.e an unbuffered chan.
151
152
func (w * Watcher ) Read (fd int , done chan OpResult ) error {
152
153
if cap (done ) != 0 {
153
154
return ErrBufferedChan
@@ -160,7 +161,8 @@ func (w *Watcher) Read(fd int, done chan OpResult) error {
160
161
}
161
162
}
162
163
163
- // Write submits a write requests and notify with done, the cap(done) must be 0, i.e unbuffered chan.
164
+ // Write submits a write requests and notify IO-completion with done channel,
165
+ // the capacity of done has to be be 0, i.e an unbuffered chan.
164
166
func (w * Watcher ) Write (fd int , buf []byte , done chan OpResult ) error {
165
167
// do nothing
166
168
if len (buf ) == 0 {
0 commit comments