Grappa  r3821, hash 22cd626d567a91ead5b23302066d1e9469f45c66
Grappa::CountingSemaphore Class Reference

Counting semaphore. Maximum count is 2^15 - 1. More...

#include <CountingSemaphoreLocal.hpp>

Public Member Functions

 CountingSemaphore ()
 
 CountingSemaphore (int64_t initial_count)
 
void increment (int64_t incr=1)
 
void decrement (int64_t decr=1)
 
bool try_decrement (int64_t decr=1)
 
int16_t get_value () const
 

Public Attributes

union {
   struct {
      int16_t   count_: 16
 
      intptr_t   waiters_: 48
 
   } 
 
   intptr_t   raw_
 
}; 
 

Static Public Attributes

static const size_t max_value = (1 << 15) - 1
 

Detailed Description

Counting semaphore. Maximum count is 2^15 - 1.

Definition at line 48 of file CountingSemaphoreLocal.hpp.

Constructor & Destructor Documentation

Grappa::CountingSemaphore::CountingSemaphore ( )
inline

Definition at line 66 of file CountingSemaphoreLocal.hpp.

Grappa::CountingSemaphore::CountingSemaphore ( int64_t  initial_count)
inline

Definition at line 73 of file CountingSemaphoreLocal.hpp.

Member Function Documentation

void Grappa::CountingSemaphore::decrement ( int64_t  decr = 1)
inline

Definition at line 94 of file CountingSemaphoreLocal.hpp.

int16_t Grappa::CountingSemaphore::get_value ( ) const
inline

Definition at line 118 of file CountingSemaphoreLocal.hpp.

void Grappa::CountingSemaphore::increment ( int64_t  incr = 1)
inline

Definition at line 82 of file CountingSemaphoreLocal.hpp.

bool Grappa::CountingSemaphore::try_decrement ( int64_t  decr = 1)
inline

Definition at line 107 of file CountingSemaphoreLocal.hpp.

Member Data Documentation

union { ... }
int16_t Grappa::CountingSemaphore::count_

Definition at line 58 of file CountingSemaphoreLocal.hpp.

const size_t Grappa::CountingSemaphore::max_value = (1 << 15) - 1
static

Definition at line 64 of file CountingSemaphoreLocal.hpp.

intptr_t Grappa::CountingSemaphore::raw_

Definition at line 61 of file CountingSemaphoreLocal.hpp.

intptr_t Grappa::CountingSemaphore::waiters_

Definition at line 59 of file CountingSemaphoreLocal.hpp.


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