コード例 #1
0
// async
redisAsyncContext* RedisClientPool::borrowItemAsync(aeEventLoop *loop)
{
	redisAsyncContext* rt = NULL;
	{
		ScopedLock lock(unUsedAsyncMutex_);
		while (!unUsedAsync_.empty())
		{
			rt = unUsedAsync_.front();
			unUsedAsync_.pop_front();
			if (rt->err == REDIS_OK)
			{
				return rt;
			}
			else
			{
				// FIXME: asyncContext no need to free?
				//        redisFree(rt);
				continue;
			}
		}
	}
	rt = createAsync(loop);
	if (rt != NULL)
	{
		ScopedLock lock(unUsedAsyncMutex_);
		usedAsync_++;
	}
	return rt;
}
コード例 #2
0
void Sprite3D::createAsync(const std::string &modelPath, const std::function<void(Sprite3D*, void*)>& callback, void* callbackparam)
{
    createAsync(modelPath, "", callback, callbackparam);
}