本文整理汇总了C++中ProcessPtr::isAlive方法的典型用法代码示例。如果您正苦于以下问题:C++ ProcessPtr::isAlive方法的具体用法?C++ ProcessPtr::isAlive怎么用?C++ ProcessPtr::isAlive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessPtr
的用法示例。
在下文中一共展示了ProcessPtr::isAlive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oobwAllowed
bool
Group::shouldInitiateOobw(const ProcessPtr &process) const {
return process->oobwStatus == Process::OOBW_REQUESTED
&& process->enabled != Process::DETACHED
&& process->isAlive()
&& oobwAllowed();
}
示例2: getPool
void
Group::requestOOBW(const ProcessPtr &process) {
// Standard resource management boilerplate stuff...
PoolPtr pool = getPool();
boost::unique_lock<boost::mutex> lock(pool->syncher);
if (isAlive() && process->isAlive() && process->oobwStatus == Process::OOBW_NOT_ACTIVE) {
process->oobwStatus = Process::OOBW_REQUESTED;
}
}
示例3:
bool
Pool::detachProcessUnlocked(const ProcessPtr &process,
boost::container::vector<Callback> &postLockActions)
{
if (OXT_LIKELY(process->isAlive())) {
verifyInvariants();
Group *group = process->getGroup();
group->detach(process, postLockActions);
// 'process' may now be a stale pointer so don't use it anymore.
assignSessionsToGetWaiters(postLockActions);
possiblySpawnMoreProcessesForExistingGroups();
group->verifyInvariants();
verifyInvariants();
verifyExpensiveInvariants();
return true;
} else {
return false;
}
}
示例4: ri
// The 'self' parameter is for keeping the current Group object alive while this thread is running.
void
Group::spawnThreadOOBWRequest(GroupPtr self, ProcessPtr process) {
TRACE_POINT();
this_thread::disable_interruption di;
this_thread::disable_syscall_interruption dsi;
Socket *socket;
Connection connection;
PoolPtr pool = getPool();
Pool::DebugSupportPtr debug = pool->debugSupport;
UPDATE_TRACE_POINT();
P_DEBUG("Performing OOBW request for process " << process->inspect());
if (debug != NULL && debug->oobw) {
debug->debugger->send("OOBW request about to start");
debug->messages->recv("Proceed with OOBW request");
}
UPDATE_TRACE_POINT();
{
// Standard resource management boilerplate stuff...
boost::unique_lock<boost::mutex> lock(pool->syncher);
if (OXT_UNLIKELY(!process->isAlive()
|| process->enabled == Process::DETACHED
|| !isAlive()))
{
return;
}
if (process->enabled != Process::DISABLED) {
UPDATE_TRACE_POINT();
P_INFO("Out-of-Band Work canceled: process " << process->inspect() <<
" was concurrently re-enabled.");
if (debug != NULL && debug->oobw) {
debug->debugger->send("OOBW request canceled");
}
return;
}
assert(process->oobwStatus == Process::OOBW_IN_PROGRESS);
assert(process->sessions == 0);
socket = process->sessionSockets.top();
assert(socket != NULL);
}
UPDATE_TRACE_POINT();
unsigned long long timeout = 1000 * 1000 * 60; // 1 min
try {
this_thread::restore_interruption ri(di);
this_thread::restore_syscall_interruption rsi(dsi);
// Grab a connection. The connection is marked as fail in order to
// ensure it is closed / recycled after this request (otherwise we'd
// need to completely read the response).
connection = socket->checkoutConnection();
connection.fail = true;
ScopeGuard guard(boost::bind(&Socket::checkinConnection, socket, connection));
// This is copied from RequestHandler when it is sending data using the
// "session" protocol.
char sizeField[sizeof(uint32_t)];
SmallVector<StaticString, 10> data;
data.push_back(StaticString(sizeField, sizeof(uint32_t)));
data.push_back(makeStaticStringWithNull("REQUEST_METHOD"));
data.push_back(makeStaticStringWithNull("OOBW"));
data.push_back(makeStaticStringWithNull("PASSENGER_CONNECT_PASSWORD"));
data.push_back(makeStaticStringWithNull(process->connectPassword));
uint32_t dataSize = 0;
for (unsigned int i = 1; i < data.size(); i++) {
dataSize += (uint32_t) data[i].size();
}
Uint32Message::generate(sizeField, dataSize);
gatheredWrite(connection.fd, &data[0], data.size(), &timeout);
// We do not care what the actual response is ... just wait for it.
UPDATE_TRACE_POINT();
waitUntilReadable(connection.fd, &timeout);
} catch (const SystemException &e) {
P_ERROR("*** ERROR: " << e.what() << "\n" << e.backtrace());
} catch (const TimeoutException &e) {
P_ERROR("*** ERROR: " << e.what() << "\n" << e.backtrace());
}
UPDATE_TRACE_POINT();
vector<Callback> actions;
{
// Standard resource management boilerplate stuff...
PoolPtr pool = getPool();
boost::unique_lock<boost::mutex> lock(pool->syncher);
if (OXT_UNLIKELY(!process->isAlive() || !isAlive())) {
return;
}
process->oobwStatus = Process::OOBW_NOT_ACTIVE;
if (process->enabled == Process::DISABLED) {
//.........这里部分代码省略.........
示例5: getProcess
void
Session::requestOOBW() {
ProcessPtr process = getProcess();
assert(process->isAlive());
process->getGroup()->requestOOBW(process);
}