Using C# is it possible to test if a lock is held on a file

后端 未结 5 1579
我寻月下人不归
我寻月下人不归 2021-01-22 17:51

BACKGROUND: I use an offset into a file and the Filestream lock/unlock menthods to control read/write access. I am using the following code to test if a lock i

5条回答
  •  太阳男子
    2021-01-22 18:35

    Personally I would just catch a locked file when trying to open it. If it's unlocked now, it may be locked when you try to open it (even if it's just a few ms later).

提交回复
热议问题