我想在glibc-2.14.1包中找到暂停和σ挂起的源文件。I grep包并找到文件sysdeps/posix/pause.c有函数暂停的定义,代码是
int
__libc_pause (void)
{
sigset_t set;
__sigemptyset (&set);
__sigprocmask (SIG_BLOCK, NULL, &set);
/* pause is a cancellation point, but so is sigsuspend.
So no need for anything special
有没有人知道在斯坦的for循环中是否有一种暂停的方法?有点像Sys.sleep(duration),但用斯坦语。我想暂停for循环,以便有时间阅读我决定打印的语句。
现在,我有两个不太优雅的解决方案:
使用
for (i in 1:1) {...},这会取消循环
如果解决方案是特定于平台的,我使用的是Linux或MacOS.。
使用Java,我在linux环境中执行一个进程,如下所示
Process startPingProcess = Runtime.getRuntime()().exec(ping -c 50 74.125.228.71);
我们在java中使用startPingProcess.exitValue()检查进程是否已经完成执行,如果正常完成,它将执行return 0。
假设我通过执行下面的代码在中间终止了上面启动的进程
Runtime.getRuntime()().exec(kill -2 processid); - where processid is process id of above st