[−][src]Function libmpv_sys::mpv_create_weak_client
pub unsafe extern "C" fn mpv_create_weak_client(
ctx: *mut mpv_handle,
name: *const c_char
) -> *mut mpv_handle
This is the same as mpv_create_client(), but the created mpv_handle is treated as a weak reference. If all mpv_handles referencing a core are weak references, the core is automatically destroyed. (This still goes through normal uninit of course. Effectively, if the last non-weak mpv_handle is destroyed, then the weak mpv_handles receive MPV_EVENT_SHUTDOWN and are asked to terminate as well.)
Note if you want to use this like refcounting: you have to be aware that mpv_terminate_destroy() and mpv_destroy() for the last non-weak mpv_handle will block until all weak mpv_handles are destroyed.