本文整理汇总了C++中ProcessPtr::inspect方法的典型用法代码示例。如果您正苦于以下问题:C++ ProcessPtr::inspect方法的具体用法?C++ ProcessPtr::inspect怎么用?C++ ProcessPtr::inspect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessPtr
的用法示例。
在下文中一共展示了ProcessPtr::inspect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disable
void
Group::initiateOobw(const ProcessPtr &process) {
assert(process->oobwStatus == Process::OOBW_REQUESTED);
process->oobwStatus = Process::OOBW_IN_PROGRESS;
if (process->enabled == Process::ENABLED
|| process->enabled == Process::DISABLING)
{
// We want the process to be disabled. However, disabling a process is potentially
// asynchronous, so we pass a callback which will re-aquire the lock and call this
// method again.
P_DEBUG("Disabling process " << process->inspect() << " in preparation for OOBW");
DisableResult result = disable(process,
boost::bind(&Group::lockAndMaybeInitiateOobw, this,
_1, _2, shared_from_this()));
switch (result) {
case DR_SUCCESS:
// Continue code flow.
break;
case DR_DEFERRED:
// lockAndMaybeInitiateOobw() will eventually be called.
return;
case DR_ERROR:
case DR_NOOP:
P_DEBUG("Out-of-band work for process " << process->inspect() << " aborted "
"because the process could not be disabled");
process->oobwStatus = Process::OOBW_NOT_ACTIVE;
return;
default:
P_BUG("Unexpected disable() result " << result);
}
}
assert(process->enabled == Process::DISABLED);
assert(process->sessions == 0);
P_DEBUG("Initiating OOBW request for process " << process->inspect());
interruptableThreads.create_thread(
boost::bind(&Group::spawnThreadOOBWRequest, this, shared_from_this(), process),
"OOBW request thread for process " + process->inspect(),
POOL_HELPER_THREAD_STACK_SIZE);
}
示例2: getPool
// The 'self' parameter is for keeping the current Group object alive
void
Group::lockAndMaybeInitiateOobw(const ProcessPtr &process, DisableResult result, GroupPtr self) {
TRACE_POINT();
// Standard resource management boilerplate stuff...
PoolPtr pool = getPool();
boost::unique_lock<boost::mutex> lock(pool->syncher);
if (OXT_UNLIKELY(!process->isAlive() || !isAlive())) {
return;
}
assert(process->oobwStatus == Process::OOBW_IN_PROGRESS);
if (result == DR_SUCCESS) {
if (process->enabled == Process::DISABLED) {
P_DEBUG("Process " << process->inspect() << " disabled; proceeding " <<
"with out-of-band work");
process->oobwStatus = Process::OOBW_REQUESTED;
if (shouldInitiateOobw(process)) {
initiateOobw(process);
} else {
// We do not re-enable the process because it's likely that the
// administrator has explicitly changed the state.
P_DEBUG("Out-of-band work for process " << process->inspect() << " aborted "
"because the process no longer requests out-of-band work");
process->oobwStatus = Process::OOBW_NOT_ACTIVE;
}
} else {
// We do not re-enable the process because it's likely that the
// administrator has explicitly changed the state.
P_DEBUG("Out-of-band work for process " << process->inspect() << " aborted "
"because the process was reenabled after disabling");
process->oobwStatus = Process::OOBW_NOT_ACTIVE;
}
} else {
P_DEBUG("Out-of-band work for process " << process->inspect() << " aborted "
"because the process could not be disabled");
process->oobwStatus = Process::OOBW_NOT_ACTIVE;
}
}
示例3: findOldestIdleProcess
/**
* Calls Group::detach() so be sure to fix up the invariants afterwards.
* See the comments for Group::detach() and the code for detachProcessUnlocked().
*/
ProcessPtr
Pool::forceFreeCapacity(const Group *exclude,
boost::container::vector<Callback> &postLockActions)
{
ProcessPtr process = findOldestIdleProcess(exclude);
if (process != NULL) {
P_DEBUG("Forcefully detaching process " << process->inspect() <<
" in order to free capacity in the pool");
Group *group = process->getGroup();
assert(group != NULL);
assert(group->getWaitlist.empty());
group->detach(process, postLockActions);
}
return process;
}
示例4: ri
void
Group::spawnThreadRealMain(const SpawnerPtr &spawner, const Options &options, unsigned int restartsInitiated) {
TRACE_POINT();
this_thread::disable_interruption di;
this_thread::disable_syscall_interruption dsi;
PoolPtr pool = getPool();
Pool::DebugSupportPtr debug = pool->debugSupport;
bool done = false;
while (!done) {
bool shouldFail = false;
if (debug != NULL && debug->spawning) {
UPDATE_TRACE_POINT();
this_thread::restore_interruption ri(di);
this_thread::restore_syscall_interruption rsi(dsi);
this_thread::interruption_point();
string iteration;
{
LockGuard g(debug->syncher);
debug->spawnLoopIteration++;
iteration = toString(debug->spawnLoopIteration);
}
P_DEBUG("Begin spawn loop iteration " << iteration);
debug->debugger->send("Begin spawn loop iteration " +
iteration);
vector<string> cases;
cases.push_back("Proceed with spawn loop iteration " + iteration);
cases.push_back("Fail spawn loop iteration " + iteration);
MessagePtr message = debug->messages->recvAny(cases);
shouldFail = message->name == "Fail spawn loop iteration " + iteration;
}
ProcessPtr process;
ExceptionPtr exception;
try {
UPDATE_TRACE_POINT();
this_thread::restore_interruption ri(di);
this_thread::restore_syscall_interruption rsi(dsi);
if (shouldFail) {
throw SpawnException("Simulated failure");
} else {
process = spawner->spawn(options);
process->setGroup(shared_from_this());
}
} catch (const thread_interrupted &) {
break;
} catch (const tracable_exception &e) {
exception = copyException(e);
// Let other (unexpected) exceptions crash the program so
// gdb can generate a backtrace.
}
UPDATE_TRACE_POINT();
ScopeGuard guard(boost::bind(Process::forceTriggerShutdownAndCleanup, process));
boost::unique_lock<boost::mutex> lock(pool->syncher);
if (!isAlive()) {
if (process != NULL) {
P_DEBUG("Group is being shut down so dropping process " <<
process->inspect() << " which we just spawned and exiting spawn loop");
} else {
P_DEBUG("The group is being shut down. A process failed "
"to be spawned anyway, so ignoring this error and exiting "
"spawn loop");
}
// We stop immediately because any previously assumed invariants
// may have been violated.
break;
} else if (restartsInitiated != this->restartsInitiated) {
if (process != NULL) {
P_DEBUG("A restart was issued for the group, so dropping process " <<
process->inspect() << " which we just spawned and exiting spawn loop");
} else {
P_DEBUG("A restart was issued for the group. A process failed "
"to be spawned anyway, so ignoring this error and exiting "
"spawn loop");
}
// We stop immediately because any previously assumed invariants
// may have been violated.
break;
}
verifyInvariants();
assert(m_spawning);
assert(processesBeingSpawned > 0);
processesBeingSpawned--;
assert(processesBeingSpawned == 0);
UPDATE_TRACE_POINT();
vector<Callback> actions;
if (process != NULL) {
AttachResult result = attach(process, actions);
if (result == AR_OK) {
guard.clear();
if (getWaitlist.empty()) {
pool->assignSessionsToGetWaiters(actions);
} else {
//.........这里部分代码省略.........