From 9402261dda39bf2f47b44dfe17b0cdd77cb98d4b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 18 Aug 2015 15:30:56 +0200 Subject: [PATCH] os: Add Handle_registry::has_handle Issue #1649 --- repos/os/include/os/handle_registry.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repos/os/include/os/handle_registry.h b/repos/os/include/os/handle_registry.h index 6930a22e9d..72d4c53c10 100644 --- a/repos/os/include/os/handle_registry.h +++ b/repos/os/include/os/handle_registry.h @@ -188,6 +188,16 @@ class Genode::Handle_registry * \throw Lookup_failed */ Weak_ptr &lookup(HANDLE handle) const { return _lookup(handle); } + + /** + * Return true if 'obj' is registered under the specified handle + * + * \throw Lookup_failed + */ + bool has_handle(OBJ const &obj, HANDLE handle) const + { + return obj.weak_ptr_const() == _lookup(handle); + } }; #endif /* _INCLUDE__OS__HANDLE_REGISTRY_H_ */