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

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

#include <cap_alloc>

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

Detailed Description

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

Automatic capability that implements automatic free and unmap 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.

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).
Smart capability class.
_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 153 of file cap_alloc.


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