本文整理汇总了C++中Child::add_range方法的典型用法代码示例。如果您正苦于以下问题:C++ Child::add_range方法的具体用法?C++ Child::add_range怎么用?C++ Child::add_range使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Child
的用法示例。
在下文中一共展示了Child::add_range方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mypid
//.........这里部分代码省略.........
-1);
}
else
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Child process %d has pid = %d.\n"),
i,
(int)(child->getpid ())));
}
}
// Keep reading time ranges reported from the children until all the
// children have exited. Alternate between checking for a range and
// checking for exits.
int processes = Nr_Processes;
Child *children[Nr_Processes];
for (i = 0; i < Nr_Processes; i++)
children[i] = (i == 0 ? &writer : &readers[i-1]);
Range_Report report;
ACE_Time_Value poll (0);
ACE_INET_Addr from;
ssize_t bytes;
while (processes > 0)
{
ACE_Time_Value limit (10);
bytes = sock.recv (&report, sizeof (report), from, 0, &limit);
if (bytes > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Report from child %d; %b bytes\n"),
report.child_, bytes));
if (report.child_ == 0)
writer.add_range (report.range_);
else
{
if (report.child_ >= 1 && report.child_ < Nr_Processes)
readers[report.child_ - 1].add_range (report.range_);
else
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Report from out-of-range child #%d\n"),
report.child_));
}
}
else
{
if (errno == ETIME)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("UDP time out; check child exits\n")));
else
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("UDP recv")));
}
for (i = 0; i < Nr_Processes; i++)
{
if (children[i] == 0)
continue;
ACE_exitcode child_status;
// See if the child has exited.
int wait_result = children[i]->wait (poll, &child_status);
if (wait_result == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Wait for child %d, %p\n"),
i, ACE_TEXT ("error")));
else if (wait_result != 0)
{
if (child_status == 0)