Skip to content

Instantly share code, notes, and snippets.

@fsouza
Created November 7, 2012 20:46
Show Gist options
  • Save fsouza/4034318 to your computer and use it in GitHub Desktop.
Save fsouza/4034318 to your computer and use it in GitHub Desktop.
package main
import (
"os"
"syscall"
"time"
)
func main() {
f, err := os.OpenFile("/Users/f/txaws.diff", syscall.O_RDONLY|syscall.O_EXLOCK, 0644)
if err != nil {
panic(err)
}
go func() {
time.Sleep(10e9)
f.Close()
}()
f2, err := os.OpenFile("/Users/f/txaws.diff", syscall.O_RDONLY|syscall.O_EXLOCK, 0644)
if err != nil {
panic(err)
}
f2.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment