L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4Re::Util::Ref_del_cap< T > Struct Template Reference

Automatic capability that implements automatic free and unmap+delete of the capability selector. More...

#include <cap_alloc>

+ Collaboration diagram for L4Re::Util::Ref_del_cap< T >:

Detailed Description

template<typename T>
struct L4Re::Util::Ref_del_cap< T >

Automatic capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters
TType of the object that is referred by the capability.

This kind of automatic capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Ref_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

{
ds_cap(L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>());
// reference count for the allocated cap selector is now 1
// use the dataspace cap
L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));
global_ds_cap = ds_cap;
// reference count is now 2
...
}
// reference count dropped to 1 (ds_cap is no longer existing).
...
global_ds_cap = L4_INVALID_CAP;
// reference count dropped to 0 (data space shall be deleted).
Smart capability class.
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:168
_Cap_alloc & cap_alloc
Capability allocator.
long chksys(long err, char const *extra="", long ret=0)
Generate C++ exception on error.
Definition error_helper:68

Definition at line 194 of file cap_alloc.


The documentation for this struct was generated from the following file: