func (f *T) Unlock() error {
	return f.doUnlock()
}
Unlock unlocks the file.
package flock
import (
	"context"
	"sync"
	"syscall"
	"github.com/grailbio/base/log"
)
type T struct {
	name string
	fd   int
	mu   sync.Mutex
}
func New(path string) *T {
	return &T{name: path}
}
func (f *T) Lock(ctx context.Context) (err error) {
	reqCh := make(chan func() error, 2)
	doneCh := make(chan error)
	go func() {
		var err error
		for req := range reqCh {
			if err == nil {
				err = req()
			}
			doneCh <- err
		}
	}()
	reqCh <- f.doLock
	select {
	case <-ctx.Done():
		reqCh <- f.doUnlock
		err = ctx.Err()
	case err = <-doneCh:
	}
	close(reqCh)
	return err
}