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

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

+ 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:

L4Re::Util::Ref_cap<L4Re::Dataspace>::Cap global_ds_cap;
{
L4Re::Util::Ref_cap<L4Re::Dataspace>::Cap
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).

Definition at line 235 of file cap_alloc.


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