本文整理汇总了C++中ACE_ARGV::buf方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_ARGV::buf方法的具体用法?C++ ACE_ARGV::buf怎么用?C++ ACE_ARGV::buf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_ARGV
的用法示例。
在下文中一共展示了ACE_ARGV::buf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: argv
// This function runs the parent process in a separate worker thread.
static ACE_THR_FUNC_RETURN
worker_parent (void *arg)
{
long handle_signals_synchronously =
reinterpret_cast <long> (arg);
ACE_Process_Options options;
ACE_TCHAR *l_argv[3];
ACE_TCHAR pid_str[100];
// Store the parent's process id so we can pass it to the child
// portably. Also, pass the test number, as well.
ACE_OS::sprintf (pid_str,
ACE_TEXT ("-p %ld -t %d"),
static_cast <long> (parent_pid),
test_number);
// We're going to create a new process that runs this program again,
// so we need to indicate that it's the child.
const ACE_TCHAR *t = ACE_TEXT (".")
ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("%sSignal_Test")
ACE_PLATFORM_EXE_SUFFIX
ACE_TEXT (" -c");
l_argv[0] = const_cast <ACE_TCHAR *> (t);
l_argv[1] = pid_str;
l_argv[2] = 0;
ACE_ARGV argv (l_argv);
// Generate a command-line!
ACE_TString exe_sub_dir;
const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR");
if (subdir_env)
{
exe_sub_dir = ACE_TEXT_CHAR_TO_TCHAR (subdir_env);
exe_sub_dir += ACE_DIRECTORY_SEPARATOR_STR;
}
options.command_line (argv.buf (), exe_sub_dir.c_str ());
ACE_Process pm;
child_pid = pm.spawn (options);
if (child_pid == ACE_INVALID_PID)
ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) spawning child process failed\n"), 0);
else
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) spawning child process %d\n"),
child_pid));
// Perform a <wait> until our child process has exited.
if (handle_signals_synchronously)
{
int status;
// Wait for the child process to exit.
pm.wait (&status);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) reaped child with status %d\n"),
status));
}
else
while (shut_down == 0)
{
// Wait for a signal to arrive.
if (ACE_OS::sigsuspend (0) == -1 && errno != EINTR)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("sigsuspend")));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) got signal!\n")));
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) parent worker done\n")));
return 0;
}