summaryrefslogtreecommitdiff
path: root/rwcancel/rwcancel.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--rwcancel/rwcancel.go (renamed from rwcancel/rwcancel_unix.go)26
1 files changed, 6 insertions, 20 deletions
diff --git a/rwcancel/rwcancel_unix.go b/rwcancel/rwcancel.go
index 739a8c3..aac743a 100644
--- a/rwcancel/rwcancel_unix.go
+++ b/rwcancel/rwcancel.go
@@ -12,26 +12,6 @@ import (
"syscall"
)
-type RWCancel struct {
- fd int
- closingReader *os.File
- closingWriter *os.File
-}
-
-type fdSet struct {
- fdset unix.FdSet
-}
-
-func (fdset *fdSet) set(i int) {
- bits := 32 << (^uint(0) >> 63)
- fdset.fdset.Bits[i/bits] |= 1 << uint(i%bits)
-}
-
-func (fdset *fdSet) check(i int) bool {
- bits := 32 << (^uint(0) >> 63)
- return (fdset.fdset.Bits[i/bits] & (1 << uint(i%bits))) != 0
-}
-
func max(a, b int) int {
if a > b {
return a
@@ -39,6 +19,12 @@ func max(a, b int) int {
return b
}
+type RWCancel struct {
+ fd int
+ closingReader *os.File
+ closingWriter *os.File
+}
+
func NewRWCancel(fd int) (*RWCancel, error) {
err := unix.SetNonblock(fd, true)
if err != nil {