Extra Process file locks

坚强是说给别人听的谎言 提交于 2019-12-11 06:47:56

问题


I have a .NET system where I need to allow files to be locked and unlocked across process boundaries. The model I plan to use is this:

  1. User generate a lock token
  2. Uses Locks a file with token and refreshes token
  3. repeat at #2 as needed
  4. Uses unlocks all files by releasing token
  5. If uses fails to refresh token in some time-frame, #4 happens automatically

Each step can be done from a different process.

The question is two fold: is this a reasonable model and are there any readily available tools for implementing it? If this can't be directly done in the OS, I'm thinking of some sort of advisory locking with .files or the like.

Edit: this mode gets non-exclusive read locks, but other modes could get exclusive write locks but they would always be released by the same process that got them.

来源:https://stackoverflow.com/questions/804356/extra-process-file-locks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!