Example #1
0
void AStdMemFile::RemoveBytes(size_t bytes)
{
	bytes   = MIN(bytes, Length);
	Pos     = SUBZ(Pos, bytes);
	Length -= bytes;
	if (Length) memmove(pData, pData + bytes, Length);
}
Example #2
0
void ADVBLock::ReleaseLock(uint_t n)
{
	const ADVBConfig& config = ADVBConfig::Get();
	LOCK *lock = (LOCK *)lockhash.Read(name);

	(void)config;

	if (lock) {
		lock->refcount = SUBZ(lock->refcount, n);

		if (!lock->refcount) {
			AString lockfile = GetFilename(lock);

			close(lock->fd);
			lock->fd = -1;

			//config.logit("Released lock '%s' (filename '%s')\n", name.str(), lockfile.str());

			lockhash.Remove(name);
		}
	}
}