@@ -39,9 +39,9 @@ func (s *FDSet) Add(fds ...int) {
3939
4040// FDResultSets contains the result of a Select operation.
4141type FDResultSets struct {
42- readable * unix.FdSet
43- writeable * unix.FdSet
44- errors * unix.FdSet
42+ readable unix.FdSet
43+ writeable unix.FdSet
44+ errors unix.FdSet
4545}
4646
4747// IsReadable test if a file descriptor is ready to be read.
@@ -66,30 +66,21 @@ func (r *FDResultSets) IsError(fd int) bool {
6666// The function will block until an event happens or the timeout expires.
6767// The function return an FDResultSets that contains all the file descriptor
6868// that have a pending read/write/error event.
69- func Select (rd , wr , er * FDSet , timeout time.Duration ) (* FDResultSets , error ) {
69+ func Select (rd , wr , er * FDSet , timeout time.Duration ) (FDResultSets , error ) {
7070 max := 0
71- res := & FDResultSets {}
71+ res := FDResultSets {}
7272 if rd != nil {
73- // fdsets are copied so the parameters are left untouched
74- copyOfRd := rd .set
75- res .readable = & copyOfRd
76- // Determine max fd.
73+ res .readable = rd .set
7774 max = rd .max
7875 }
7976 if wr != nil {
80- // fdsets are copied so the parameters are left untouched
81- copyOfWr := wr .set
82- res .writeable = & copyOfWr
83- // Determine max fd.
77+ res .writeable = wr .set
8478 if wr .max > max {
8579 max = wr .max
8680 }
8781 }
8882 if er != nil {
89- // fdsets are copied so the parameters are left untouched
90- copyOfEr := er .set
91- res .errors = & copyOfEr
92- // Determine max fd.
83+ res .errors = er .set
9384 if er .max > max {
9485 max = er .max
9586 }
@@ -98,9 +89,9 @@ func Select(rd, wr, er *FDSet, timeout time.Duration) (*FDResultSets, error) {
9889 var err error
9990 if timeout != - 1 {
10091 t := unix .NsecToTimeval (timeout .Nanoseconds ())
101- _ , err = unix .Select (max + 1 , res .readable , res .writeable , res .errors , & t )
92+ _ , err = unix .Select (max + 1 , & res .readable , & res .writeable , & res .errors , & t )
10293 } else {
103- _ , err = unix .Select (max + 1 , res .readable , res .writeable , res .errors , nil )
94+ _ , err = unix .Select (max + 1 , & res .readable , & res .writeable , & res .errors , nil )
10495 }
10596 return res , err
10697}
0 commit comments