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

Thread safe version of counter for Counting_cap_alloc. More...

#include <counting_cap_alloc>

+ Collaboration diagram for L4Re::Util::Counter_atomic< COUNTER >:

Detailed Description

template<typename COUNTER = unsigned char>
struct L4Re::Util::Counter_atomic< COUNTER >

Thread safe version of counter for Counting_cap_alloc.

Despite using atomic instructions, this version has to make sure that capability slots are not reused too early. If the last reference is gone, the capability slot has to be unmapped. The slot must only be allocated again when the unmap has completed. This is accomplished by starting with an initial count of 2. The last reference will decrease the counter to 1. Only then, after the slot was unmapped, will the counter be set to 0. This will allow other threads to reallocate the slot.

Definition at line 73 of file counting_cap_alloc.


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