mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-11 19:28:05 -05:00
Kernel: New handle manager
This handle manager more closely mirrors the behaviour of the CTR-OS one. In addition object ref-counts and support for DuplicateHandle have been added. Note that support for DuplicateHandle is still experimental, since parts of the kernel still use Handles internally, which will likely cause troubles if two different handles to the same object are used to e.g. wait on a synchronization primitive.
This commit is contained in:
@ -54,7 +54,8 @@ public:
|
||||
|
||||
/// Allocates a new handle for the service
|
||||
Handle CreateHandle(Kernel::Object *obj) {
|
||||
Handle handle = Kernel::g_handle_table.Create(obj);
|
||||
// TODO(yuriks): Fix error reporting
|
||||
Handle handle = Kernel::g_handle_table.Create(obj).ValueOr(INVALID_HANDLE);
|
||||
m_handles.push_back(handle);
|
||||
return handle;
|
||||
}
|
||||
@ -62,7 +63,7 @@ public:
|
||||
/// Frees a handle from the service
|
||||
template <class T>
|
||||
void DeleteHandle(const Handle handle) {
|
||||
Kernel::g_handle_table.Destroy<T>(handle);
|
||||
Kernel::g_handle_table.Close(handle);
|
||||
m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user