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
Notify event pipe before releasing NativeActivity resources (#134)
The design of ndk-glue seems to imply that the user of a `NativeActivity`
resource, e.g. `NativeWindow` obtained from `ndk_glue::native_window()`, should
hold a read lock on the resource as long as they are using it.
Therefore, ndk-glue's `NativeActivity` callbacks related to resource release
should: (1) notify the user of upcoming resource release, (2) acquire a write
lock on the handle, waiting for all read locks to be dropped, (3) drop the
handle, (4) return from the callback. This allows the user to react and correctly
release various objects derived from the resource (e.g. swapchains/surfaces
from `NativeWindow`) before it goes away. Currently, the order is 2-3-1-4, which
can lead to a deadlock (if the user holds on to a read guard) or a race condition
(if they drop the read guard early).
This commit fixes the order.
0 commit comments