3 ms·
We could potentially create a background worker thread for closing handles.
by jart 2y ago
We 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.