I am utilizing transferable objects in the communication between my main thread and physics worker. The Float32Array is being shared back and forth with great efficiency. How can I determine if a Float32Array has been neutered?
For instance, here is an example array:
this.transferableArray = new Float32Array();
Sent as a transferable object:
worker.postMessage(this.transferableArray, [this.transferableArray.buffer]);
Currently in my code, I am checking if it's neutered like this:
if (!transferableArray.length) {
return false;
}
Is this the correct way to check for neutering, or is there a more efficient method to determine if the array is neutered? In a game like mine, every millisecond gained is crucial.