A class used for the abstraction of semaphores.  
 More...
#include <shared_memory.h>
|  | 
|  | semaphore () | 
|  | Empty semaphore constructor, clears all values.  More... 
 | 
|  | 
|  | semaphore () | 
|  | 
|  | semaphore (const char *name, int oflag, mode_t mode, unsigned int value) | 
|  | Constructs a named semaphore.  More... 
 | 
|  | 
|  | semaphore (const char *name, int oflag, mode_t mode, unsigned int value) | 
|  | 
|  | ~semaphore () | 
|  | The deconstructor.  More... 
 | 
|  | 
|  | ~semaphore () | 
|  | 
| void | close () | 
|  | Closes the currently opened semaphore.  More... 
 | 
|  | 
| void | close () | 
|  | 
| int | getVal () const | 
|  | 
| int | getVal () const | 
|  | Returns the current value of the semaphore.  More... 
 | 
|  | 
| void | open (const char *name, int oflag, mode_t mode=0, unsigned int value=0) | 
|  | 
| void | open (const char *name, int oflag, mode_t mode=0, unsigned int value=0) | 
|  | Opens a semaphore.  More... 
 | 
|  | 
|  | operator bool () const | 
|  | 
|  | operator bool () const | 
|  | Returns whether we have a valid semaphore.  More... 
 | 
|  | 
| void | post () | 
|  | 
| void | post () | 
|  | Posts to the semaphore, increases its value by one.  More... 
 | 
|  | 
| bool | tryWait () | 
|  | Tries to wait for the semaphore, returns true if successful, false otherwise.  More... 
 | 
|  | 
| bool | tryWait () | 
|  | 
| bool | tryWaitOneSecond () | 
|  | Tries to wait for the semaphore for a single second, returns true if successful, false otherwise.  More... 
 | 
|  | 
| bool | tryWaitOneSecond () | 
|  | 
| void | unlink () | 
|  | 
| void | unlink () | 
|  | Unlinks the previously opened semaphore.  More... 
 | 
|  | 
| void | wait () | 
|  | Waits for the semaphore, decreases its value by one.  More... 
 | 
|  | 
| void | wait () | 
|  | 
A class used for the abstraction of semaphores. 
      
        
          | IPC::semaphore::semaphore | ( |  | ) |  | 
      
 
Empty semaphore constructor, clears all values. 
 
 
      
        
          | IPC::semaphore::semaphore | ( | const char * | name, | 
        
          |  |  | int | oflag, | 
        
          |  |  | mode_t | mode, | 
        
          |  |  | unsigned int | value | 
        
          |  | ) |  |  | 
      
 
Constructs a named semaphore. 
- Parameters
- 
  
    | name | The name of the semaphore |  | oflag | The flags with which to open the semaphore |  | mode | The mode in which to create the semaphore, if O_CREAT is given in oflag, ignored otherwise |  | value | The initial value of the semaphore if O_CREAT is given in oflag, ignored otherwise |  
 
 
 
      
        
          | IPC::semaphore::~semaphore | ( |  | ) |  | 
      
 
 
      
        
          | IPC::semaphore::semaphore | ( |  | ) |  | 
      
 
 
      
        
          | IPC::semaphore::semaphore | ( | const char * | name, | 
        
          |  |  | int | oflag, | 
        
          |  |  | mode_t | mode, | 
        
          |  |  | unsigned int | value | 
        
          |  | ) |  |  | 
      
 
 
      
        
          | IPC::semaphore::~semaphore | ( |  | ) |  | 
      
 
 
      
        
          | void IPC::semaphore::close | ( |  | ) |  | 
      
 
Closes the currently opened semaphore. 
 
 
      
        
          | void IPC::semaphore::close | ( |  | ) |  | 
      
 
 
      
        
          | int IPC::semaphore::getVal | ( |  | ) | const | 
      
 
Returns the current value of the semaphore. 
 
 
      
        
          | int IPC::semaphore::getVal | ( |  | ) | const | 
      
 
 
      
        
          | void IPC::semaphore::open | ( | const char * | name, | 
        
          |  |  | int | oflag, | 
        
          |  |  | mode_t | mode = 0, | 
        
          |  |  | unsigned int | value = 0 | 
        
          |  | ) |  |  | 
      
 
 
      
        
          | void IPC::semaphore::open | ( | const char * | name, | 
        
          |  |  | int | oflag, | 
        
          |  |  | mode_t | mode = 0, | 
        
          |  |  | unsigned int | value = 0 | 
        
          |  | ) |  |  | 
      
 
Opens a semaphore. 
Closes currently opened semaphore if needed 
- Parameters
- 
  
    | name | The name of the semaphore |  | oflag | The flags with which to open the semaphore |  | mode | The mode in which to create the semaphore, if O_CREAT is given in oflag, ignored otherwise |  | value | The initial value of the semaphore if O_CREAT is given in oflag, ignored otherwise |  
 
 
 
      
        
          | IPC::semaphore::operator bool | ( |  | ) | const | 
      
 
Returns whether we have a valid semaphore. 
 
 
      
        
          | IPC::semaphore::operator bool | ( |  | ) | const | 
      
 
 
      
        
          | void IPC::semaphore::post | ( |  | ) |  | 
      
 
Posts to the semaphore, increases its value by one. 
 
 
      
        
          | void IPC::semaphore::post | ( |  | ) |  | 
      
 
 
      
        
          | bool IPC::semaphore::tryWait | ( |  | ) |  | 
      
 
Tries to wait for the semaphore, returns true if successful, false otherwise. 
 
 
      
        
          | bool IPC::semaphore::tryWait | ( |  | ) |  | 
      
 
 
      
        
          | bool IPC::semaphore::tryWaitOneSecond | ( |  | ) |  | 
      
 
Tries to wait for the semaphore for a single second, returns true if successful, false otherwise. 
 
 
      
        
          | bool IPC::semaphore::tryWaitOneSecond | ( |  | ) |  | 
      
 
 
      
        
          | void IPC::semaphore::unlink | ( |  | ) |  | 
      
 
 
      
        
          | void IPC::semaphore::unlink | ( |  | ) |  | 
      
 
Unlinks the previously opened semaphore. 
 
 
      
        
          | void IPC::semaphore::wait | ( |  | ) |  | 
      
 
Waits for the semaphore, decreases its value by one. 
 
 
      
        
          | void IPC::semaphore::wait | ( |  | ) |  | 
      
 
 
  
  | 
        
          | std::string IPC::semaphore::myName |  | private | 
 
 
  
  | 
        
          | sem_t * IPC::semaphore::mySem |  | private | 
 
 
The documentation for this class was generated from the following files: