コード例 #1
0
uint64 ZTS_Umbrella::pAllocateID(ZRef<ZTS> iTS)
	{
	for (;;)
		{
		uint64 theID;
		size_t countIssued;
		iTS->AllocateIDs(1, theID, countIssued);
		if (countIssued)
			return theID;
		}
	}
コード例 #2
0
ファイル: ZTSoup.cpp プロジェクト: zoolib/zoolib_old
bool ZTSoup::AllocateIDs(size_t iCount, uint64& oBaseID, size_t& oCountIssued)
	{
	ZMutexLocker locker_TSWatcher(fMutex_TSWatcher);
	ZRef<ZTSWatcher> theTSWatcher = fTSWatcher;
	if (!theTSWatcher)
		return false;
	locker_TSWatcher.Release();

	if (theTSWatcher->AllocateIDs(iCount, oBaseID, oCountIssued))
		return true;

	locker_TSWatcher.Acquire();
	fTSWatcher.Clear();

	oCountIssued = 0;
	return false;
	}