Exemplo n.º 1
0
Fd::operator int () const
{
	if(!IsAcquired())
		throw std::logic_error("!IsAcquired() (Fd::operator int ())");

	return TheFd;
}
Exemplo n.º 2
0
int Fd::Release()
{
	if(!IsAcquired())
		throw std::logic_error("!IsAcquired() (Fd::Release())");

	int OldFd = TheFd;
	TheFd = -1;
	return OldFd;
}
Exemplo n.º 3
0
void Fd::Close()
{
	if(!IsAcquired())
		throw std::logic_error("IsAcquired() (Fd::Close())");

	if(close(TheFd) != 0)
		throw ErrnoException(errno, "Fd::Close()");

	TheFd = -1;
}
Exemplo n.º 4
0
void Fd::Acquire(const int NewFd)
{
	if(NewFd < 0)
		throw std::invalid_argument("NewFd < 0 (Fd::Acquire())");

	if(IsAcquired())
		throw std::logic_error("IsAcquired() (Fd::Acquire())");

	TheFd = NewFd;
}
SystemWideMutex::~SystemWideMutex()
{
    assert(data_);
    while(IsAcquired()) data_->Release_(true);
    delete data_;
}
Exemplo n.º 6
0
Fd::~Fd()
{
	if(IsAcquired())
		Close();
}