本文整理汇总了C++中ObjectHandle::initWithPID方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectHandle::initWithPID方法的具体用法?C++ ObjectHandle::initWithPID怎么用?C++ ObjectHandle::initWithPID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectHandle
的用法示例。
在下文中一共展示了ObjectHandle::initWithPID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stubPC
/* virtual */ SysStatus
MemTrans::init(ProcessID partner, XHandle &remoteX,
uval size, MTEvents *handler)
{
debug = 0;
SysStatus rc = 0;
CObjRootSingleRep::Create(this);
uval addr = 0;
ObjectHandle myFRInt;
ObjectHandle localOH;
ObjectHandle remoteOH;
localSize = size;
//Ref count is 1 --- for whoever created this object
refCount = 1;
allocLock.init();
cbs = handler;
// Lock out allocations until we're done initialization
AutoLock<LockType> al(&allocLock);
// Give other process access to this MT
rc = giveAccessByServer(localOH, partner);
_IF_FAILURE_RET(rc);
remoteX = localOH.xhandle();
usedPages.append(new PageUse(localSize/PAGE_SIZE, 0));
// Create FR for local-side memory area (that will be exported)
rc = StubFRComputation::_Create(myFRInt);
_IF_FAILURE_RET_VERBOSE(rc);
localFR.setOH(myFRInt);
rc = StubRegionDefault::_CreateFixedLenExt(
localBase, localSize, 0, myFRInt, 0, AccessMode::writeUserWriteSup, 0,
RegionType::K42Region);
_IF_FAILURE_RET_VERBOSE(rc);
// Create an OH to a global object in the other process and
// look for a matching MemTrans there
// But, if this is the kernel, we never attempt this ---
// Can't trust the other process to not block us on this
// So we always wait for the other process to call _swapHandle
if (DREFGOBJ(TheProcessRef)->getPID() == _KERNEL_PID) {
return 0;
}
ObjectHandle SMTDB;
SMTDB.initWithPID(partner,XHANDLE_MAKE_NOSEQNO(CObjGlobals::ProcessIndex));
StubProcessClient stubPC(StubObj::UNINITIALIZED);
stubPC.setOH(SMTDB);
rc = stubPC._getMemTrans(remoteOH, key);
if (_SUCCESS(rc)) {
StubMemTrans remote(StubObj::UNINITIALIZED);
remote.setOH(remoteOH);
uval remoteSize;
ObjectHandle frOH;
// Give access to this area to the other process
// FIXME: give access for read only
ObjectHandle myFRExt;
rc = localFR._giveAccess(myFRExt, partner);
_IF_FAILURE_RET_VERBOSE(rc);
// Give remote process OH's to our FR and MT
rc = remote._swapHandle(localOH, myFRExt, localSize,
remoteSize, frOH);
_IF_FAILURE_RET_VERBOSE(rc);
rc = StubRegionDefault::_CreateFixedLenExt(
addr, remoteSize, 0, frOH, 0, AccessMode::writeUserWriteSup, 0,
RegionType::K42Region);
_IF_FAILURE_RET_VERBOSE(rc);
ClientData *cd = clnt(remoteX);
cd->init(frOH, remoteOH, addr, remoteSize);
remote._completeInit();
}
//.........这里部分代码省略.........