Torque 3D 3.7
SFXInternal::gDeadBufferList Variable
ThreadSafeDeque< SFXBuffer* > gDeadBufferList;

List of buffers that are pending deletion. 

This is a messy issue. Buffers with live async states cannot be instantly deleted since they may still be running concurrent updates. However, they also cannot be deleted on the update thread since the StrongRefBase stuff isn't thread-safe (i.e weak references kept by client code would cause trouble). 

So, what we do is mark buffers for deletion, wait till they surface on the process list and then ping them back to this list to have them deleted by the SFXDevice itself on the main thread. A bit of overhead but only a fraction of the buffers will ever undergo this procedure.

Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!