FS: Explicit File::release() after reads/writes are done
The file system has been designed to not know how many files are currently in use, but NativeFile has an operating system specific limitation on the maximum number of open files.
Instead of trying to keep track of all open native files, ensure the handles are closed when file access is done. There were threading issues trying to flush open files from a thread while another thread is still accessing the file, or attempting to do its own flush.
File::release() releases all the internal buffers and resources, so it encompasses write flushing but also closing of the file handles after reading.
The idea here is for users to call File::release() after they're done with a file. Certain operations like Reader/Writer being destroyed will cause an automatic release.
FS: Explicit File::release() after reads/writes are done
The file system has been designed to not know how many files are currently in use, but NativeFile has an operating system specific limitation on the maximum number of open files.
Instead of trying to keep track of all open native files, ensure the handles are closed when file access is done. There were threading issues trying to flush open files from a thread while another thread is still accessing the file, or attempting to do its own flush.
File::release() releases all the internal buffers and resources, so it encompasses write flushing but also closing of the file handles after reading.
The idea here is for users to call File::release() after they're done with a file. Certain operations like Reader/Writer being destroyed will cause an automatic release.