コード例 #1
0
void ZServer::Start(ZRef<ZCaller> iCaller,
	ZRef<ZStreamerRWFactory> iFactory,
	ZRef<Callable_Connection> iCallable_Connection)
	{
	ZAssert(iCaller);
	ZAssert(iFactory);

	// Declared before the acq, so it goes out of scope after it, and any
	// callable on the roster is invoked with our mutex released.
	ZRef<ZRoster> priorRoster;

	ZAcqMtx acq(fMtx);

	ZAssert(not fWorker);
	ZAssert(not fFactory);
	ZAssert(not fCallable_Connection);

	priorRoster = fRoster;
	fRoster = new ZRoster;

	fFactory = iFactory;
	fCallable_Connection = iCallable_Connection;

	fWorker = new ZWorker(
		sCallable(sWeakRef(this), &ZServer::pWork),
		sCallable(sWeakRef(this), &ZServer::pWorkDetached));

	fWorker->Attach(iCaller);

	fWorker->Wake();
	}
コード例 #2
0
ZRef<Callable_PullSuggested> Searcher_DatonSet::GetCallable_PullSuggested()
	{
	ZAcqMtxR acq(fMtxR);
	if (not fCallable_PullSuggested_Self)
		fCallable_PullSuggested_Self = sCallable(sWeakRef(this), &Searcher_DatonSet::pPullSuggested);
	return fCallable_PullSuggested_Self;
	}