3 ms·
What are these gaping differences? File locks are a horror show. No doubt. But I can't think of any truly terrible differences with the other things you mention
by jart 2y ago
What are these gaping differences? File locks are a horror show. No doubt. But I can't think of any truly terrible differences with the other things you mentioned.
- shakna 2y agoFile locks are the thing that has most been biting me, to be honest. The horrow show of NTFS, and Windows Defender, where a 'close' can become a costly operation.
- jart 2y agoWe could potentially create a background worker thread for closing handles.
- shakna 2y agoFrom memory, rustup ended up creating a worker for closing handles, to avoid dealing with Windows Defender. So it can be a valid approach. Though, cosmo might then run into Windows not being happy with two things attempting to open the same file, if the programmer then attempts to reopen the file. You could do some logic that cancels closing in the thread, and re-hands the handle to the user if the handle still exists, but that might be a little fragile. To be honest... There may not actually be a good answer that works 100% of the time. Working around the platform might introduce race conditions you absolutely don't want.