本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
306B

  1. // +build !windows
  2. package osfs
  3. import (
  4. "golang.org/x/sys/unix"
  5. )
  6. func (f *file) Lock() error {
  7. f.m.Lock()
  8. defer f.m.Unlock()
  9. return unix.Flock(int(f.File.Fd()), unix.LOCK_EX)
  10. }
  11. func (f *file) Unlock() error {
  12. f.m.Lock()
  13. defer f.m.Unlock()
  14. return unix.Flock(int(f.File.Fd()), unix.LOCK_UN)
  15. }
上海开阖软件有限公司 沪ICP备12045867号-1