所以我有一个简单的 fork 和 exec 程序。它工作得很好,但我希望能够分离已启动的进程,我尝试分叉而不等待:
if((pid = fork()) < 0)
perror("Error with Fork()");
else if(pid > 0) {
return "";
}
else {
if(execl("/bin/bash", "/bin/bash", "-c", cmddo, (char*) 0) < 0) perror("execl()");
exit(0);
}
Run Code Online (Sandbox Code Playgroud)
它启动过程很好,但是当我的主应用程序关闭时 - 我的分叉过程也是如此。
在主进程(启动它的)关闭后,如何保持分叉进程运行?
感谢:D
认为这将是网站上的某个地方,因为所有3个示例图像都是这样的:

也许它完成了phonegap?不用担心.
我尝试将ons-navigator和各种项目设置为透明,背景颜色等等.
有谁知道如何设置背景看起来像他们的例子?
希望在c ++中分叉一个不会挂起其父进程的进程 - 它的父进程是守护进程并且必须保持运行.如果我在分叉进程上等待(),分叉的execl将不会分流 - 但是 - 它也会挂起应用程序 - 而不是等待修复应用程序挂起 - 但命令变得无法解决.
if((pid = fork()) < 0)
perror("Error with Fork()");
else if(pid > 0) {
//wait here will hang the execl in the parent
//dont wait will defunt the execl command
//---- wait(&pid);
return "";
} else {
struct rlimit rl;
int i;
if (rl.rlim_max == RLIM_INFINITY)
rl.rlim_max = 1024;
for (i = 0; (unsigned) i < rl.rlim_max; i++)
close(i);
if(execl("/bin/bash", "/bin/bash", "-c", "whoami", (char*) 0) < 0) perror("execl()");
exit(0); …Run Code Online (Sandbox Code Playgroud) 我找不到任何有关如何正确计算 c# 的 ProcessorAffinity 上的亲和力设置的文档。
我正在传递选定核心的列表并添加它们以获得最终的亲和力设置,但是我的计算似乎已关闭。
如何根据所选核心 (0-32/64) 的列表正确计算亲和力。
另外这该如何优化呢?
if (!string.IsNullOrEmpty(affinitystr) && !affinitystr.Equals("-1"))
{
string[] words = affinitystr.Split(',');
int affinitytotal = 0;
foreach (string word in words)
{
int affinity = Convert.ToInt32(word);
if (affinity == 0) { affinity = 1; } // core 0
else if (affinity == 1) { affinity = 2; } // core 1
else if (affinity == 2) { affinity = 4; } // core 2
else if (affinity == 3) { affinity = 8; …Run Code Online (Sandbox Code Playgroud)