Skip to content

Commit

Permalink
Remove pollWithContext (dead code)
Browse files Browse the repository at this point in the history
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
  • Loading branch information
evacchi committed Jul 28, 2023
1 parent 6ea6aa7 commit 18dfb48
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions internal/sysfs/poll_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sysfs

import (
"context"
"syscall"
"time"
"unsafe"
Expand Down Expand Up @@ -43,11 +42,6 @@ const pollInterval = 100 * time.Millisecond

// poll implements poll on Windows, for a subset of cases.
//
// This internally invokes pollWithContext with a default context.
func poll(fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) {
return pollWithContext(context.TODO(), fds, timeoutMillis)
}

// pollWithContext emulates the behavior of POSIX poll(2) on Windows, for a subset of cases,
// and it supports context cancellation.
//
Expand All @@ -64,7 +58,7 @@ func poll(fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) {
//
// The duration may be negative, in which case it will wait indefinitely. The given ctx is
// used to allow for cancellation, and it is currently used only in tests.
func pollWithContext(ctx context.Context, fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) {
func poll(fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) {
if fds == nil {
return -1, sys.ENOSYS
}
Expand Down Expand Up @@ -101,8 +95,6 @@ func pollWithContext(ctx context.Context, fds []pollFd, timeoutMillis int32) (n

for {
select {
case <-ctx.Done():
return 0, 0
case <-afterCh:
return 0, 0
case <-tickCh:
Expand Down

0 comments on commit 18dfb48

Please sign in to comment.