You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The object and proxy point to each other and maintain a ref count. We swap two pointers when swapping assets. There is a hazard that another thread could modify the reference counts on a proxy that no longer matches the object.
A potential solution is to have a global sync point for all threads every frame and do asset swaps during that sync. We could have a flag and a counter for threads that actively use the reference counting. A thread wanting to do a swap could add the swap to a list and set the flag. All threads would eventually need to sync, and when they see the flag, they would decrement their count and wait. The thread that decrements to zero would then do the swap and signal all other threads to start again, possibly with a condition.
We will need to take care that posix and windows threads have consistent behavior and ensure that all threads resume again.
The text was updated successfully, but these errors were encountered:
The object and proxy point to each other and maintain a ref count. We swap two pointers when swapping assets. There is a hazard that another thread could modify the reference counts on a proxy that no longer matches the object.
A potential solution is to have a global sync point for all threads every frame and do asset swaps during that sync. We could have a flag and a counter for threads that actively use the reference counting. A thread wanting to do a swap could add the swap to a list and set the flag. All threads would eventually need to sync, and when they see the flag, they would decrement their count and wait. The thread that decrements to zero would then do the swap and signal all other threads to start again, possibly with a condition.
We will need to take care that posix and windows threads have consistent behavior and ensure that all threads resume again.
The text was updated successfully, but these errors were encountered: