This is not thread safe and will break if several threads open files simultaneously.
Moreover, opening and closing a file will increment the Handles size by one and this will never decrement back.
This should be fixed — one way or another.
I propose us to migrate to some GCHandles to pin the file handle objects instead, and pass actual pointers to the app code. But we should see how to not miss the standard handles then.
Currently we use code such as this: https://github.com/ForNeVeR/Cesium/blob/d48d71e910ba319171a40e44966833bc691f1ce2/Cesium.Runtime/StdIoFunctions.cs#L532-L533
This is not thread safe and will break if several threads open files simultaneously.
Moreover, opening and closing a file will increment the
Handles
size by one and this will never decrement back.This should be fixed — one way or another.
I propose us to migrate to some GCHandles to pin the file handle objects instead, and pass actual pointers to the app code. But we should see how to not miss the standard handles then.