我正试图在无头服务器上执行firefox来拍摄网站的屏幕截图.我可以从终端使用这样做
"DISPLAY =:12 firefox -saveimage http://www.google.com/ ".
问题是当我尝试做系统时("DISPLAY =:12 firefox -saveimage http://www.google.com "); 不起作用.我觉得它不是在正常的shell环境中执行.我违背了我更好的判断,给了apache用户一个真正的shell.如果我对apache执行并执行命令一切正常并按预期工作,但它再次无法通过系统调用工作.任何见解都非常受欢迎.
我整个上午都搜索过,似乎无法找到这个问题的答案.
我有线程阵列,每个做工作,然后我会通过IDS环接合每一个然后开始新主题.什么是检测当一个线程已经完成,所以我可以火了一个新的线程,而无需等待每个线程结束的最好方法?
编辑添加了代码片段也许这会有所帮助
if (threadCount > maxItems)
{
threadCount = maxItems;
}
threads = new Thread[threadCount];
for (int i = 0; i < threadCount; i++)
{
threads[i] = new Thread(delegate() { this.StartThread(); });
threads[i].Start();
}
while (loopCounter < threadCount)
{
if (loopCounter == (threadCount - 1))
{
loopCounter = 0;
}
if (threads[loopCounter].ThreadState == ThreadState.Stopped)
{
threads[loopCounter] = new Thread(delegate() { this.StartThread(); });
threads[loopCounter].Start();
}
}
Run Code Online (Sandbox Code Playgroud)