L4Re - L4 Runtime Environment
L4Re::Util::Auto_cap< T > Struct Template Reference

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

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

Detailed Description

template<typename T>
struct L4Re::Util::Auto_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.
Deprecated:
Use L4Re::Util::Unique_cap.

This kind of automatic capability is useful for capabilities that shall have a lifetime that is strictly coupled to one C++ scope.

Usage:

{
L4Re::Util::Auto_cap<L4Re::Dataspace>::Cap
ds_cap(L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>());
// use the dataspace cap
L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));
...
// At the end of the scope ds_cap is unmapped and the capability selector
// is freed.
}

Definition at line 163 of file cap_alloc.


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