Grappa  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 37 of file CountingSemaphoreLocal.hpp.

Constructor & Destructor Documentation

Grappa::CountingSemaphore::CountingSemaphore ( )
inline

Definition at line 55 of file CountingSemaphoreLocal.hpp.

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

Definition at line 62 of file CountingSemaphoreLocal.hpp.

Member Function Documentation

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

Definition at line 83 of file CountingSemaphoreLocal.hpp.

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

Definition at line 107 of file CountingSemaphoreLocal.hpp.

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

Definition at line 71 of file CountingSemaphoreLocal.hpp.

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

Definition at line 96 of file CountingSemaphoreLocal.hpp.

Member Data Documentation

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

Definition at line 47 of file CountingSemaphoreLocal.hpp.

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

Definition at line 53 of file CountingSemaphoreLocal.hpp.

intptr_t Grappa::CountingSemaphore::raw_

Definition at line 50 of file CountingSemaphoreLocal.hpp.

intptr_t Grappa::CountingSemaphore::waiters_

Definition at line 48 of file CountingSemaphoreLocal.hpp.


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