UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Attributes | List of all members
dcf::IPCSem Class Reference

#include <ipc_sem.hpp>

Public Member Functions

 IPCSem (bool is_local=true)
 
virtual ~IPCSem ()
 
dcf::error_t create (size_t res_num, int id, const std::string &fname, int mask=0666)
 
dcf::error_t create (size_t res_num, key_t key, int mask=0666)
 
dcf::error_t operator++ ()
 
dcf::error_t operator-- ()
 
dcf::error_t allocate (size_t rn=1)
 
dcf::error_t release (size_t rn=1)
 

Protected Attributes

int m_sid
 
key_t m_key
 
size_t m_res_num
 
int m_mask
 
bool m_is_local
 

Detailed Description

IPC Semaphore

Constructor & Destructor Documentation

dcf::IPCSem::IPCSem ( bool  is_local = true)
Default constructor.  Parameter "is_local" defines does 

semaphore live only when object is created or alltime.

virtual dcf::IPCSem::~IPCSem ( )
virtual

Removes semaphore if it is not local.

Member Function Documentation

dcf::error_t dcf::IPCSem::allocate ( size_t  rn = 1)

Allocates provided number of resources. Returns ErrSuccess if all correct.

dcf::error_t dcf::IPCSem::create ( size_t  res_num,
int  id,
const std::string &  fname,
int  mask = 0666 
)

Constructs new semaphore. Access rules mask.

Parameters
res_numNumber of resources to be allocated/deallocated.
idUniq semaphore id for key generation.
fnameExists file name for key generation.
dcf::error_t dcf::IPCSem::create ( size_t  res_num,
key_t  key,
int  mask = 0666 
)

Constructs new semaphore with provided key. Access rules mask.

Parameters
res_numNumber of resources to be allocated/deallocated.
keySemaphore uniq key
dcf::error_t dcf::IPCSem::operator++ ( )
inline

Allocate one resource.

dcf::error_t dcf::IPCSem::operator-- ( )
inline

Free one resource

dcf::error_t dcf::IPCSem::release ( size_t  rn = 1)

Releases provided number of resources. Returns ErrSuccess if all correct.

Member Data Documentation

bool dcf::IPCSem::m_is_local
protected

Does semaphore should be removed after object destruction.

key_t dcf::IPCSem::m_key
protected

Semaphore uniq key.

int dcf::IPCSem::m_mask
protected

Access rules mask.

size_t dcf::IPCSem::m_res_num
protected

Number of resources for allocation.

int dcf::IPCSem::m_sid
protected

Id of semaphore. (>0 if it is created.)


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