本文整理汇总了C++中FileMap::get方法的典型用法代码示例。如果您正苦于以下问题:C++ FileMap::get方法的具体用法?C++ FileMap::get怎么用?C++ FileMap::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMap
的用法示例。
在下文中一共展示了FileMap::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
void daemon_pipe::exec()
{
CHECK(!m_specs.empty(), "no procs to execute");
SignalBlocker signals;
// LockFile will be unlocked on destruction; don't do this until
// after the ProcHarvester is destroyed
LockFile lock;
// ProcHarvester will wait for all children on destruction. Since we want
// all the FDs to get closed before that happens, this must be instantiated
// before the FileMap.
ProcHarvester harvester(&signals.m_sigset);
// build a map of all the files we're going to need to open, and whether
// we need to read or write from them
FileMap files;
for(std::vector<daemon_proc_spec_ptr>::iterator i = m_specs.begin(), end = m_specs.end(); i != end; ++i)
{
Proc &proc(harvester.addProc(*i));
if((*i)->m_stdin)
proc.m_stdin = files.get((*i)->m_stdin, true, false);
if((*i)->m_stdout)
proc.m_stdout = files.get((*i)->m_stdout, false, true);
if((*i)->m_stderr)
proc.m_stderr = files.get((*i)->m_stderr, false, true);
}
if(!m_lockFile.empty())
lock.open(m_lockFile);
std::vector<File *>::const_iterator file = files.m_files.begin(),
end = files.m_files.end();
for(; file != end; ++file)
(*file)->open();
int pgid = 0;
for(std::vector<ProcPtr>::iterator i = harvester.m_procs.begin(), end = harvester.m_procs.end(); i != end; ++i)
{
Proc &proc = **i;
proc.m_blockedSignals = &signals;
proc.m_newPGID = pgid;
int pid = proc.safe_fork_exec();
if(pgid == 0)
pgid = pid;
}
}