[Windows] How to check if a file is locked by a process?

694 views
Skip to first unread message

Gyu-Ho Lee

unread,
Jan 3, 2016, 1:18:08 AM1/3/16
to golang-nuts
Hello,

Is there any Windows function similar to Unix's syscall.Flock function?

to see if I can find anything related but I am no expert in Windows platform and don't see any file lock calls.

I want to check if a file is being locked by a process and if not, lock the file for my Go program in Windows.

Please let me know if anybody knows what would work for this case.

Thanks!



Tamás Gulácsi

unread,
Jan 3, 2016, 1:57:30 AM1/3/16
to golang-nuts

Gyu-Ho Lee

unread,
Jan 3, 2016, 2:01:04 AM1/3/16
to Tamás Gulácsi, golang-nuts
Thanks!

On Sat, Jan 2, 2016 at 10:57 PM, Tamás Gulácsi <tgula...@gmail.com> wrote:
See https://github.com/tgulacsi/lock/blob/master/lock_windows.go

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/mQnKRPuHvEQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely,
Gyu-Ho Lee

Reply all
Reply to author
Forward
0 new messages