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

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

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

Detailed Description

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

This kind of automatic capability is useful for capabilities with that shall have a lifetime that is strictly coupled to one C++ scope. The main difference to Auto_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:

{
L4Re::Util::Auto_del_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. Because the deletion flag is set the data space shall be
// also deleted (even if there are other references to this data space).
}

Definition at line 200 of file cap_alloc.


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