dokan-dev / dokany

User mode file system library for windows with FUSE Wrapper
http://dokan-dev.github.io
5.2k stars 661 forks source link

Does Dokany support synchronization on a per-file basis? #1138

Closed lanopk closed 1 year ago

lanopk commented 1 year ago

Feature request can skip this form. Bug report must complete it. Check List must be 100% match or it will be automatically closed without further discussion. Please remove this line.

Environment

Check List

Description

Hello.

Does Dokany support synchronization on a per-file basis?

When multiple processes access the same file at the same time, I want to synchronize them so that only one call is made at a time. For example, when multiple processes are requesting to write to the same file, I want to wait for the other processes to write after one has finished.

If not, I was hoping you could give me some hints on how to implement such a feature.

Thanks.

Logs

Please attach in separate files: mirror output, library logs and kernel logs. In case of BSOD, please attach minidump or dump analyze output.

Liryna commented 1 year ago

Hi @lanopk ,

This is not possible and if it was you would have the whole operating system hanging pretty bad since all the other applications will be locked (if they don't write async) while waiting for one of the app to write.

Even if this side effect is ignored, you can't know exactly when an application is done to write. They could be keeping their write handle opened for the lifetime of their instance. They could be written by chunk with large elapse time between while processing data.

If your question is due to your internal handle not being thread safe, you could use a mutex specific to that file that you lock for the time of the write request whatever the app is doing it.

lanopk commented 1 year ago

Thank you for your response.