【发布时间】:2019-07-06 16:17:37
【问题描述】:
也许这是一个“我不知道我在问什么”的问题,所以如果我有什么需要知道的,请告诉我。
在运行带有或不带参数的程序时(不包括程序路径/名称参数),会启动一个进程。我们可以多次运行程序,因此将启动多个进程。而且我正在寻找某种方法来在多次运行程序时保留一个进程。像单身的东西。例如
在伪代码中:
...
bool tasksCompleted = false;
...
while !tasksCompleted{
input = waitForNewInputFromConsole();
launch_new_thread(HandleInput, input);
}
在控制台中:
>do_cool_stuff a b c - one process is launched, arguments a, b and c are passed, now HandleInput is handling them in new thread nad we're now wating for new input from console.
>do_cool_stuff x y - we have still one process, and x and y are passed, HandleInput is handling them in new thread, we're again waiting for more data.
如果你知道我的意思,并且可以帮助我解决这个问题,请这样做。
提前致谢, 干杯。
【问题讨论】:
标签: c++ terminal process console