L4Re Operating System Framework
Interface and Usage Documentation
|
Thread safe version of counter for Counting_cap_alloc. More...
#include <counting_cap_alloc>
Public Member Functions | |
bool | inc () |
Increment counter if not yet saturated. | |
Type | dec () |
Decrement counter if not saturated. | |
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 109 of file counting_cap_alloc.
|
inline |
Decrement counter if not saturated.
Once the counter reached the saturated state, the counter value isn't changed.
Definition at line 153 of file counting_cap_alloc.
|
inline |
Increment counter if not yet saturated.
Once the counter reached the saturated state, the counter value isn't changed.
false | The counter just went saturated after it was increased. |
true | Either the counter was already saturated – in that case the counter value was not changed, or the counter was not saturated – in that case the counter was increased. |
Definition at line 132 of file counting_cap_alloc.